@Override
    public int read(byte buf[], int off, int len) {
        Objects.requireNonNull(buf, "buf");
        if (off < 0 || len < 0 || len > buf.length - off) {
            throw new IndexOutOfBoundsException();
        }
        if (len == 0) return 0;

        if ( ! fetchNonEmptyBuffer() ) return -1;
        int read = 0;
        while ((available() > 0) && fetchNonEmptyBuffer() && ((len - read) > 0)) {
            int toRead = Math.min(currBuf.remaining(), (len - read));
            currBuf.get(buf, off + read, toRead);
            read += toRead;
        }
        if (marked != null) {
            if (readSinceMarked + read <= marked.length) {
                System.arraycopy(buf, off, marked, readSinceMarked, read);
                readSinceMarked += read;
            } else {
                marked = null;
            }

        }
        return read;
    }
<p>Constructs a new ContentInputStream that reads from the given {@link ReadableContentChannel}.</p>

@param content The content to read the stream from.
jdisc_core/src/main/java/com/yahoo/jdisc/handler/UnsafeContentInputStream.java