public ByteBuffer readBuffer(int length) throws IOException {
        if (length == 0) {
            return ByteBuffer.allocate(0);
        }
        ByteBuffer buffer = getBuffer();
        if (buffer.remaining() == length) { // can return current as-is?
            current++;
            return buffer; // return w/o copying
        }
        // punt: allocate a new buffer & copy into it
        ByteBuffer result = ByteBuffer.allocate(length);
        int start = 0;
        while (start < length) {
            start += read(result.array(), start, length - start);
        }
        return result;
    }
Read a buffer from the input without copying, if possible.

@param length    the need read data length
@throws java.io.EOFException if EOF is reached before reading all the bytes.
inlong-tubemq/tubemq-core/src/main/java/org/apache/inlong/tubemq/corerpc/netty/ByteBufferInputStream.java