fromByteArrayStream static method

Future<StorableHashMap<Serializer, Serializer>> fromByteArrayStream(
  1. ByteStream in_,
  2. StorableHashMap<Serializer, Serializer> map
)

Reads objects from ByteArrayInputStream and stores them in map.

@param in ByteArrayInputStream to be used @param map Map to store objects @throws IOException if value cannot be read

Implementation

static Future<StorableHashMap> fromByteArrayStream(
    ByteStream in_, StorableHashMap map) async {
  SerializerHelper.castTest('StorableHashMap', serialVersionUID,
      await SerializerHelper.readLong(in_), 1);
  map.clear();
  int size = await SerializerHelper.readInt(in_);
  for (int i = 0; i < size; i++) {
    var key = await readObject(in_);
    var value = await readObject(in_);
    map[key] = value;
  }
  SerializerHelper.castTest('StorableHashMap', serialVersionUID,
      await SerializerHelper.readLong(in_), 2);
  return map;
}