code: 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;
      }
docs: Reads payload bytes of binary, extension, or raw string types as a reference to internal buffer.
  
  <p>
  This consumes specified amount of bytes and returns its reference or copy. This method tries to
  return reference as much as possible because it is faster. However, it may copy data to a newly
  allocated buffer if reference is not applicable.
  
  @param length number of bytes to be read
  @throws IOException when underlying input throws IOException