question: public void writeAsSerializedByteArray ( Object v ) throws IOException { if ( this . ignoreWrites ) return ; checkIfWritable ( ) ; ensureCapacity ( 5 ) ; if ( v instanceof HeapDataOutputStream ) { HeapDataOutputStream other = ( HeapDataOutputStream ) v ; other . finishWriting ( ) ; InternalDataSerializer . writeArrayLength ( other . size ( ) , this ) ; if ( this . doNotCopy ) { if ( other . chunks != null ) { for ( ByteBuffer bb : other . chunks ) { write ( bb ) ; } } write ( other . buffer ) ; } else { other . sendTo ( ( ByteBufferWriter ) this ) ; other . rewind ( ) ; } } else { ByteBuffer sizeBuf = this . buffer ; int sizePos = sizeBuf . position ( ) ; sizeBuf . position ( sizePos + 5 ) ; final int preArraySize = size ( ) ; DataSerializer . writeObject ( v , this ) ; int arraySize = size ( ) - preArraySize ; sizeBuf . put ( sizePos , InternalDataSerializer . INT_ARRAY_LEN ) ; sizeBuf . putInt ( sizePos + 1 , arraySize ) ; } }
target:  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.