OEWriteMolToByteArrayΒΆ

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

byte[] OEWriteMolToByteArray(String format, OEMCMolBase mol)
byte[] OEWriteMolToByteArray(int format, 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 with a Boolean gzip parameter expect format to be specified by a constant in OEFormat.

Returns a non-empty byte[] if encoding was successful.

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