Ejemplo n.º 1
0
 @Override
 public void streamTo(OutputStream out) throws IOException {
   Streamable.Helper.intToStream(data.size(), out);
   for (SimpleEntry<String, String> entry : data) {
     Streamable.Helper.stringToStream(entry.getKey(), out);
     Streamable.Helper.stringToStream(entry.getValue(), out);
   }
 }
Ejemplo n.º 2
0
 @Override
 public void streamFrom(InputStream in) throws IOException {
   this.data
       .clear(); // Just in case we're called on an old object instead of a new one: wipe out the
                 // old data.
   int length = Streamable.Helper.intFromStream(in);
   if (length <= 0) return;
   for (int i = 0; i < length; i++) {
     String k = Streamable.Helper.stringFromStream(in);
     String v = Streamable.Helper.stringFromStream(in);
     put(k, v);
   }
 }