/** * Writes the content from object to output. * * @param object IChemObject of which the data is given as output. */ @Override public void write(IChemObject object) throws CDKException { if (object instanceof IAtomContainerSet) { writeAtomContainerSet((IAtomContainerSet) object); } else if (object instanceof IAtomContainer) { writeAtomContainer((IAtomContainer) object); } else { throw new CDKException("Only supported is writing of ChemFile and Molecule objects."); } }
/** * Writes a list of molecules to an OutputStream. * * @param som MoleculeSet that is written to an OutputStream */ public void writeAtomContainerSet(IAtomContainerSet som) { writeAtomContainer(som.getAtomContainer(0)); for (int i = 1; i <= som.getAtomContainerCount() - 1; i++) { try { writeAtomContainer(som.getAtomContainer(i)); } catch (Exception exc) { } } }