@Override public int read(byte[] b, int off, int len) throws IOException { int total_read = 0; while (len > 0) { fillBytes(); int result = currentBytes.read(b, off, len); if (result == -1) { return total_read == 0 ? -1 : total_read; } len -= result; total_read += result; off += result; } return total_read; }
@Override public int read() throws IOException { fillBytes(); return currentBytes.read(); }