The offset
is the position in the byte[]
pass to start copying data.
From the Javadoc for ObjectStream.write(byte[], int, int)
Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.
It is nothing more complicated than that and it doesn't make sense to use a length from an unrelated byte[] as an offset.
//msgBytes2 is another message with length2
mOutputStream.write(msgBytes2, length, length2);
This caases length2
to start from length
it is similar to
for(int i = length; i < length + length2; i++
mOutputStream.write(msgBytes2[i]);