@Test public void testWriteDictionary() throws IOException { Map<String, Object> m = new LinkedHashMap<>(); for (int i = 0; i < 4; i++) m.put(String.valueOf(i), i); w.writeDictionary(m); checkContents("70" + "41" + "01" + "30" + "21" + "00" + "41" + "01" + "31" + "21" + "01" + "41" + "01" + "32" + "21" + "02" + "41" + "01" + "33" + "21" + "03" + "80"); }
@Override public void writeDictionary(Map<?, ?> m) throws IOException { out.write(DICTIONARY); for (Entry<?, ?> e : m.entrySet()) { if (!(e.getKey() instanceof String)) throw new FormatException(); writeString((String) e.getKey()); writeObject(e.getValue()); } out.write(END); }
BdfWriterImpl implements BdfWriter { @Override public void writeDictionary(Map<?, ?> m) throws IOException { out.write(DICTIONARY); for (Entry<?, ?> e : m.entrySet()) { if (!(e.getKey() instanceof String)) throw new FormatException(); writeString((String) e.getKey()); writeObject(e.getValue()); } out.write(END); } }
BdfWriterImpl implements BdfWriter { @Override public void writeDictionary(Map<?, ?> m) throws IOException { out.write(DICTIONARY); for (Entry<?, ?> e : m.entrySet()) { if (!(e.getKey() instanceof String)) throw new FormatException(); writeString((String) e.getKey()); writeObject(e.getValue()); } out.write(END); } BdfWriterImpl(OutputStream out); }
BdfWriterImpl implements BdfWriter { @Override public void writeDictionary(Map<?, ?> m) throws IOException { out.write(DICTIONARY); for (Entry<?, ?> e : m.entrySet()) { if (!(e.getKey() instanceof String)) throw new FormatException(); writeString((String) e.getKey()); writeObject(e.getValue()); } out.write(END); } BdfWriterImpl(OutputStream out); @Override void flush(); @Override void close(); @Override void writeNull(); @Override void writeBoolean(boolean b); @Override void writeLong(long i); @Override void writeDouble(double d); @Override void writeString(String s); @Override void writeRaw(byte[] b); @Override void writeList(Collection<?> c); @Override void writeListStart(); @Override void writeListEnd(); @Override void writeDictionary(Map<?, ?> m); @Override void writeDictionaryStart(); @Override void writeDictionaryEnd(); }
BdfWriterImpl implements BdfWriter { @Override public void writeDictionary(Map<?, ?> m) throws IOException { out.write(DICTIONARY); for (Entry<?, ?> e : m.entrySet()) { if (!(e.getKey() instanceof String)) throw new FormatException(); writeString((String) e.getKey()); writeObject(e.getValue()); } out.write(END); } BdfWriterImpl(OutputStream out); @Override void flush(); @Override void close(); @Override void writeNull(); @Override void writeBoolean(boolean b); @Override void writeLong(long i); @Override void writeDouble(double d); @Override void writeString(String s); @Override void writeRaw(byte[] b); @Override void writeList(Collection<?> c); @Override void writeListStart(); @Override void writeListEnd(); @Override void writeDictionary(Map<?, ?> m); @Override void writeDictionaryStart(); @Override void writeDictionaryEnd();  }