@Override public void setPosition(long pos) { // NOTE: a little weird because if you // setPosition(0), the next byte you read is // bytes[0] ... but I would expect bytes[-1] (ie, // EOF)...? int bufferIndex = (int) (pos >> blockBits); nextBuffer = bufferIndex-1; current = blocks.get(bufferIndex); nextRead = (int) (pos & blockMask); assert getPosition() == pos: "pos=" + pos + " getPos()=" + getPosition(); }
@Override public void skipBytes(long count) { setPosition(getPosition() - count); }
@Override public void readBytes(byte[] b, int offset, int len) { for(int i=0;i<len;i++) { b[offset+i] = readByte(); } }
@Override public void skipBytes(long count) { setPosition(getPosition() - count); }
@Override public void setPosition(long pos) { // NOTE: a little weird because if you // setPosition(0), the next byte you read is // bytes[0] ... but I would expect bytes[-1] (ie, // EOF)...? int bufferIndex = (int) (pos >> blockBits); nextBuffer = bufferIndex-1; current = blocks.get(bufferIndex); nextRead = (int) (pos & blockMask); assert getPosition() == pos: "pos=" + pos + " getPos()=" + getPosition(); }
@Override public void setPosition(long pos) { // NOTE: a little weird because if you // setPosition(0), the next byte you read is // bytes[0] ... but I would expect bytes[-1] (ie, // EOF)...? int bufferIndex = (int) (pos >> blockBits); nextBuffer = bufferIndex-1; current = blocks.get(bufferIndex); nextRead = (int) (pos & blockMask); assert getPosition() == pos: "pos=" + pos + " getPos()=" + getPosition(); }
@Override public void skipBytes(long count) { setPosition(getPosition() - count); }
@Override public void readBytes(byte[] b, int offset, int len) { for(int i=0;i<len;i++) { b[offset+i] = readByte(); } }
@Override public void setPosition(long pos) { // NOTE: a little weird because if you // setPosition(0), the next byte you read is // bytes[0] ... but I would expect bytes[-1] (ie, // EOF)...? int bufferIndex = (int) (pos >> blockBits); nextBuffer = bufferIndex-1; current = blocks.get(bufferIndex); nextRead = (int) (pos & blockMask); assert getPosition() == pos: "pos=" + pos + " getPos()=" + getPosition(); }
@Override public void readBytes(byte[] b, int offset, int len) { for(int i=0;i<len;i++) { b[offset+i] = readByte(); } }
@Override public void skipBytes(long count) { setPosition(getPosition() - count); }
@Override public void readBytes(byte[] b, int offset, int len) { for(int i=0;i<len;i++) { b[offset+i] = readByte(); } }