@Override public InfinispanIndexInputV4 clone() { InfinispanIndexInputV4 clone = (InfinispanIndexInputV4)super.clone(); // reference counting doesn't work properly: need to use isClone // as in other Directory implementations. Apparently not all clones // are cleaned up, but the original is (especially .tis files) clone.isClone = true; return clone; }
@Override public final byte readByte() throws IOException { if (bufferPosition >= currentBufferSize) { nextChunk(); bufferPosition = 0; } return buffer[bufferPosition++]; }
private void nextChunk() throws IOException { currentLoadedChunk++; setBufferToCurrentChunk(); }
@Override public void seek(final long pos) { bufferPosition = (int) (pos % chunkSize); final int targetChunk = (int) (pos / chunkSize); if (targetChunk != currentLoadedChunk) { currentLoadedChunk = targetChunk; setBufferToCurrentChunkIfPossible(); } }
InfinispanIndexInput copyAndReset() { return new InfinispanIndexInput(filename, chunksCache, fileKey, chunkSize, filename, fileLength, affinitySegmentId); }
public IndexInput slice(String sliceDescription, long offset, long length) throws IOException { return new SlicingInfinispanIndexInput(sliceDescription, offset, length, copyAndReset()); }
@Override public void close() throws IOException { delegate.close(); }
@Override public long getFilePointer() { return delegate.getFilePointer() - offset; }
@Override public byte readByte() throws IOException { return delegate.readByte(); }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { delegate.readBytes(b, offset, len); }
@Override public void seek(final long pos) { bufferPosition = (int) (pos % chunkSize); final int targetChunk = (int) (pos / chunkSize); if (targetChunk != currentLoadedChunk) { currentLoadedChunk = targetChunk; setBufferToCurrentChunkIfPossible(); } }
InfinispanIndexInput copyAndReset() { return new InfinispanIndexInput(filename, chunksCache, fileKey, chunkSize, filename, fileLength, affinitySegmentId); }
public IndexInput slice(String sliceDescription, long offset, long length) throws IOException { return new SlicingInfinispanIndexInput(sliceDescription, offset + this.offset, length, delegate.copyAndReset()); }
@Override public void close() throws IOException { delegate.close(); }
@Override public long getFilePointer() { return delegate.getFilePointer() - offset; }
@Override public byte readByte() throws IOException { return delegate.readByte(); }
@Override public void readBytes(byte[] b, int offset, int len) throws IOException { delegate.readBytes(b, offset, len); }
@Override public InfinispanIndexInputV3 clone() { InfinispanIndexInputV3 clone = (InfinispanIndexInputV3)super.clone(); // reference counting doesn't work properly: need to use isClone // as in other Directory implementations. Apparently not all clones // are cleaned up, but the original is (especially .tis files) clone.isClone = true; return clone; }
@Override public final byte readByte() throws IOException { if (bufferPosition >= currentBufferSize) { nextChunk(); bufferPosition = 0; } return buffer[bufferPosition++]; }
@Override public void seek(final long pos) { bufferPosition = (int) (pos % chunkSize); final int targetChunk = (int) (pos / chunkSize); if (targetChunk != currentLoadedChunk) { currentLoadedChunk = targetChunk; setBufferToCurrentChunkIfPossible(); } }