public static <K, V> HashMap<K, V> readHashMap(DataInput in, DeserializationContext context)
      throws IOException, ClassNotFoundException {

    int size = readArrayLength(in);
    if (size == -1) {
      return null;
    } else {
      HashMap<K, V> map = new HashMap<>(size);
      for (int i = 0; i < size; i++) {
        K key = context.getDeserializer().readObject(in);
        V value = context.getDeserializer().readObject(in);
        map.put(key, value);
      }

      return map;
    }
  }
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