core/src/main/java/com/orientechnologies/orient/core/serialization/OMemoryStream.java
public int set(final byte[] iContent) {
    if (iContent == null)
      return -1;

    final int begin = position;

    assureSpaceFor(OBinaryProtocol.SIZE_INT + iContent.length);

    OBinaryProtocol.int2bytes(iContent.length, buffer, position);
    position += OBinaryProtocol.SIZE_INT;
    write(iContent, 0, iContent.length);

    return begin;
  }
public int set(final byte[] iContent) {
    if (iContent == null)
      return -1;

    final int begin = position;

    assureSpaceFor(OBinaryProtocol.SIZE_INT + iContent.length);

    OBinaryProtocol.int2bytes(iContent.length, buffer, position);
    position += OBinaryProtocol.SIZE_INT;
    write(iContent, 0, iContent.length);

    return begin;
  }
Append byte[] to the stream.

@param iContent
@return The begin offset of the appended content
@throws IOException