public MessageBuffer readPayloadAsReference ( int length ) throws IOException { int bufferRemaining = buffer . size ( ) - position ; if ( bufferRemaining >= length ) { MessageBuffer slice = buffer . slice ( position , length ) ; position += length ; return slice ; } MessageBuffer dst = MessageBuffer . allocate ( length ) ; readPayload ( dst , 0 , length ) ; return dst ; }
Reads payload bytes of binary extension or raw string types as a reference to internal buffer .