@Nullable
    private ByteBuf takeNext() throws InterruptedException, IOException {
        ByteBuf buffer = null;
        while (buffer == null) {
            if (interruption != null) {
                final InterruptedIOException ioe = new InterruptedIOException();
                ioe.initCause(interruption);
                throw ioe;
            }
            if (eos.get()) {
                return buffers.poll();
            } else if (timeout != null) {
                buffer = buffers.poll(timeout.toMillis(), TimeUnit.MILLISECONDS); // block during the timeout
                if (buffer == null) {
                    throw new InterruptedByTimeoutException();
                }
            } else {
                buffer = buffers.take(); // block indefinitely
            }
        }
        return buffer;
    }
Takes the next buffer from the Queue.
core/src/main/java/com/linecorp/armeria/internal/common/stream/ByteBufsInputStream.java