Abbreviations implements Iterable<String> { public int loadFromFile(final String path) throws IOException { InputStream in = null; try { in = getClass().getResourceAsStream(path); if (in != null) return loadSmiles(in); File file = new File(path); if (file.exists() && file.canRead()) return loadSmiles(new FileInputStream(file)); } finally { if (in != null) in.close(); } return 0; } Abbreviations(); @Override Iterator<String> iterator(); boolean isEnabled(final String label); boolean setEnabled(String label, boolean enabled); void setContractOnHetero(boolean val); void setContractToSingleLabel(boolean val); List<Sgroup> generate(final IAtomContainer mol); int apply(final IAtomContainer mol); boolean add(String line); boolean add(IAtomContainer mol, String label); int loadFromFile(final String path);  }
@Test public void loadFromFile() throws Exception { Abbreviations factory = new Abbreviations(); assertThat(factory.loadFromFile("obabel_superatoms.smi"), is(27)); assertThat(factory.loadFromFile("/org/openscience/cdk/depict/obabel_superatoms.smi"), is(27)); }