@Override
  public void writeAsSerializedByteArray(Object v) throws IOException {
    if (v instanceof HeapDataOutputStream) {
      size += 4; // length is encoded as an int (or less)
      size += ((HeapDataOutputStream) v).size();
    } else {
      size += 5; // length is encoded as a byte + an int
      DataSerializer.writeObject(v, this);
    }
  }
Writes the given object to this stream as a byte array. The byte array is produced by
serializing v. The serialization is done by calling DataSerializer.writeObject.
geode-core/src/main/java/org/apache/geode/internal/NullDataOutputStream.java