OEWriteMolToBytes

OEIntArray OEWriteMolToByteArray(String format, OEMolBase mol)
OEIntArray OEWriteMolToByteArray(String format, OEMCMolBase mol)

byte[] OEWriteMolToBytes(String format, OEMolBase mol)
byte[] OEWriteMolToBytes(int format, int flavor, boolean gzip, OEMolBase mol)

byte[] OEWriteMolToBytes(String format, OEMCMolBase mol)
byte[] OEWriteMolToBytes(int format, int flavor, boolean gzip, OEMCMolBase mol)

Encodes a molecule in terms of ‘format’. ‘format’ must be a file extension that is writeable by OpenEye, for example: “.oeb.gz”. Overloads which take an unsigned ‘format’, unsigned ‘flavor’ and Boolean ‘gzip’ parameters expect the format or the format and flavor to be specified by one of the constants in OEFormat and OEOFlavor.

Warning

The overload that takes an OEIntArray is deprecated as of 2018.Feb and will be removed in a future version of OEChem TK, please use OEWriteMolToBytes instead.

OEMolBase mol = new OEGraphMol();
OEChem.OESmilesToMol(mol, "c1ccccc1");
byte[] bytes = OEChem.OEWriteMolToBytes(".oeb", mol);
OEMolBase mol = new OEGraphMol();
OEChem.OESmilesToMol(mol, "c1ccccc1");
byte[] bytes = OEChem.OEWriteMolToBytes(OEFormat.OEB, OEChem.OEGetDefaultOFlavor(OEFormat.OEB), false, mol);