code: private void copy(ByteBuf src, ByteBuffer dst) {
  		// This branch is necessary, because an Exception is thrown if the
  		// destination buffer has more remaining (writable) bytes than
  		// currently readable from the Netty ByteBuf source.
  		if (src.isReadable()) {
  			if (src.readableBytes() < dst.remaining()) {
  				int oldLimit = dst.limit();
  
  				dst.limit(dst.position() + src.readableBytes());
  				src.readBytes(dst);
  				dst.limit(oldLimit);
  			}
  			else {
  				src.readBytes(dst);
  			}
  		}
  	}
docs: Copies min(from.readableBytes(), to.remaining() bytes from Nettys ByteBuf to the Java NIO ByteBuffer.