toByteArrayStream method

  1. @override
void toByteArrayStream(
  1. ByteSink out
)
override

Writes the current object to the output stream.

@param out the output stream receiving the object @throws IOException if an exception occurs while writing to the stream

Implementation

@override
void toByteArrayStream(ByteSink out) {
  SerializerHelper.writeLong(out, serialversionUID);
  SerializerHelper.writeInt(out, skeleton ? 1 : 0);
  SerializerHelper.writeString(out, path);
  SerializerHelper.writeInt(out, _ordinals.length - 1);
  for (MapEntry<Field, String> e in _ordinals.entries) {
    if (e.key != Field.path) {
      SerializerHelper.writeString(out, e.key.toString());
      SerializerHelper.writeString(out, e.value);
    }
  }

  if (!skeleton) {
    SerializerHelper.writeInt(out, _values.length);
    for (MapEntry<String, NodeValue> e in _values.entries) {
      SerializerHelper.writeString(out, e.key);
      e.value.toByteArrayStream(out);
    }
  }

  SerializerHelper.writeInt(out, _childNodes.length);
  for (MapEntry<String, Node> e in _childNodes.entries) {
    SerializerHelper.writeString(out, e.key);
    e.value.toByteArrayStream(out);
  }

  SerializerHelper.writeLong(out, serialversionUID);
}