public static void writeHashMap(Map<?, ?> map, DataOutput out, SerializationContext context)
      throws IOException {
    int size;
    if (map == null) {
      size = -1;
    } else {
      size = map.size();
    }
    writeArrayLength(size, out);
    if (size > 0) {
      for (Map.Entry<?, ?> entry : map.entrySet()) {
        context.getSerializer().writeObject(entry.getKey(), out);
        context.getSerializer().writeObject(entry.getValue(), out);
      }
    }
  }
Reads an instance of <code>String</code> from a <code>DataInput</code>. The return value may be
<code>null</code>.

@throws IOException A problem occurs while reading from <code>in</code>

@see #writeString
geode-serialization/src/main/java/org/apache/geode/internal/serialization/StaticSerialization.java