@Override public int available() { return remainingBytes(); }
@Override public int read(byte[] b, int off, int len) throws IOException { dieIfClosed(); if (b == null) { throw new IllegalArgumentException("buffer must not be null"); } if (off < 0 || len < 0 || b.length < off + len) { throw new IndexOutOfBoundsException("can't read past buffer boundaries"); } if (len == 0) { return 0; } if (atEOD()) { return EOF; } int limit = Math.min(remainingBytes(), len); readFully(b, off, limit); return limit; }
@Override public int available() { return remainingBytes(); }
@Override public int read(byte[] b, int off, int len) throws IOException { dieIfClosed(); if (b == null) { throw new IllegalArgumentException("buffer must not be null"); } if (off < 0 || len < 0 || b.length < off + len) { throw new IndexOutOfBoundsException("can't read past buffer boundaries"); } if (len == 0) { return 0; } if (atEOD()) { return EOF; } int limit = Math.min(remainingBytes(), len); readFully(b, off, limit); return limit; }