/** * Store a template library to the provided output stream. * * @param out output stream * @throws IOException low level IO error */ void store(OutputStream out) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out)); for (Entry<String, Point2d[]> e : templateMap.entries()) { bw.write(encodeEntry(e)); bw.write('\n'); } bw.close(); }
/** * Store a template library to the provided output stream. * * @param out output stream * @throws IOException low level IO error */ void store(OutputStream out) throws IOException { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out)); for (Entry<String, Point2d[]> e : templateMap.entries()) { bw.write(encodeEntry(e)); bw.write('\n'); } bw.close(); }
@Test public void encodeEntry() { String smiles = "CO"; Point2d[] points = new Point2d[]{new Point2d(12.5f, 5.5f), new Point2d(4f, 2f)}; String encoded = IdentityTemplateLibrary.encodeEntry(new SimpleEntry<String, Point2d[]>(smiles, points)); Map.Entry<String, Point2d[]> entry = IdentityTemplateLibrary.decodeEntry(encoded); assertThat(encoded, is("CO |(12.5,5.5,;4.0,2.0,)|")); }