private void setRingCursor(ByteBuffer buffer, int newCursor) { checkArgument(newCursor >= 0); buffer.putInt(4, newCursor); }
/** * Returns the offset from the file start where the latest block should be written (end of prev * block). */ private int getRingCursor(ByteBuffer buffer) { int c = buffer.getInt(4); checkState(c >= FILE_PROLOGUE_BYTES, "Integer overflow"); return c; }