A stream from another node to this node. Technically, it can also be streamed from a byte array but that is mostly for testing.
This class's methods are optimized so you can put the methods that read and write a class next to each other and you can scan them
visually for differences. That means that most variables should be read and written in a single line so even large objects fit both
reading and writing on the screen. It also means that the methods on this class are named very similarly to StreamInput. Finally
it means that the "barrier to entry" for adding new methods to this class is relatively low even though it is a shared class with code
everywhere. That being said, this class deals primarily with Lists rather than Arrays. For the most part calls should adapt to
lists, either by storing Lists internally or just converting to and from a List when calling. This comment is repeated
on StreamInput.

writeShort

writeInt

public void writeInt(int i)
throws java.io.IOException

Writes an int as four bytes.

Throws:

java.io.IOException

writeVInt

public void writeVInt(int i)
throws java.io.IOException

Writes an int in a variable-length format. Writes between one and
five bytes. Smaller values take fewer bytes. Negative numbers
will always use all 5 bytes and are therefore better serialized
using writeInt(int)

Throws:

java.io.IOException

writeLong

public void writeLong(long i)
throws java.io.IOException

Writes a long as eight bytes.

Throws:

java.io.IOException

writeVLong

public void writeVLong(long i)
throws java.io.IOException

Writes a non-negative long in a variable-length format. Writes between one and ten bytes. Smaller values take fewer bytes. Negative
numbers use ten bytes and trip assertions (if running in tests) so prefer writeLong(long) or writeZLong(long) for
negative numbers.

Throws:

java.io.IOException

writeZLong

public void writeZLong(long i)
throws java.io.IOException

Writes a long in a variable-length format. Writes between one and ten bytes.
Values are remapped by sliding the sign bit into the lsb and then encoded as an unsigned number
e.g., 0 -;> 0, -1 -;> 1, 1 -;> 2, ..., Long.MIN_VALUE -;> -1, Long.MAX_VALUE -;> -2
Numbers with small absolute value will have a small encoding
If the numbers are known to be non-negative, use writeVLong(long)

writeMapWithConsistentOrder

write map to stream with consistent order
to make sure every map generated bytes order are same.
This method is compatible with StreamInput.readMap and StreamInput.readGenericValue
This method only will handle the map keys order, not maps contained within the map

writeGenericValue

Notice: when serialization a map, the stream out map with the stream in map maybe have the
different key-value orders, they will maybe have different stream order.
If want to keep stream out map and stream in map have the same stream order when stream,
can use writeMapWithConsistentOrder