private static int readFromBuffer(ByteBuf buffer, byte[] bytes, int off, int len) {
        if (!buffer.isReadable()) {
            return -1;
        }
        len = Math.min(len, buffer.readableBytes());
        buffer.readBytes(bytes, off, len);
        return len;
    }
Closes this {@link InputStream} and releases any system resources associated with the stream.
Sets EOS, if it has not been set yet. Drains all the allocated buffers.
core/src/main/java/com/linecorp/armeria/internal/common/stream/ByteBufsInputStream.java