@Override public int read() throws IOException { if(eofReached()) return -1; checkBuffer(); int ret = block[blockOff]; blockOff++; offset ++; return ret; }
@Override public int read(byte b[], int off, int len) throws IOException { if(len==0) return 0; if(eofReached()) return -1; checkBuffer(); int nbBytes = Math.min(len, blockLen - blockOff); System.arraycopy(block, blockOff, b, off, nbBytes); blockOff += nbBytes; offset += nbBytes; return nbBytes; }