@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 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 skipBytes(long count) { setPosition(getPosition() - count); }
@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 skipBytes(long count) { setPosition(getPosition() - count); }