Package org.terrier.compression.bit
Interface BitInSeekable
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
BitFileBuffered
,BitFileChannel
,BitFileInMemory
,BitFileInMemoryLarge
,ConcurrentBitFileBuffered
public interface BitInSeekable extends java.io.Closeable
Interface for reading a bit compressed file in a random access manner. Each method returns aBitIn
implementation that allows access to the encoded integers. Several implementations exist:BitFileBuffered
- buffers an amount of data starting that the specified offset.BitFileInMemory
- reads the entire file into memory. File must be less than Integer.MAX_VALUE (2GB).BitFileInMemoryLarge
- reads the entire file into memory. File size only constrained by available memory.
- Since:
- 2.0
- Author:
- Craig Macdonald
- See Also:
BitFileBuffered
,BitOut
,BitIn
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BitIn
readReset(long startByteOffset, byte startBitOffset)
Reads from the file a specific number of bytes and after this call, a sequence of read calls may follow.BitIn
readReset(long startByteOffset, byte startBitOffset, long endByteOffset, byte endBitOffset)
Reads from the file a specific number of bytes and after this call, a sequence of read calls may follow.
-
-
-
Method Detail
-
readReset
BitIn readReset(long startByteOffset, byte startBitOffset, long endByteOffset, byte endBitOffset) throws java.io.IOException
Reads from the file a specific number of bytes and after this call, a sequence of read calls may follow. The offsets given as arguments are inclusive. For example, if we call this method with arguments 0, 2, 1, 7, it will read in a buffer the contents of the underlying file from the third bit of the first byte to the last bit of the second byte.- Parameters:
startByteOffset
- the starting byte to read fromstartBitOffset
- the bit offset in the starting byteendByteOffset
- the ending byteendBitOffset
- the bit offset in the ending byte. This bit is the last bit of this entry.- Returns:
- Returns the BitIn object to use to read that data
- Throws:
java.io.IOException
-
readReset
BitIn readReset(long startByteOffset, byte startBitOffset) throws java.io.IOException
Reads from the file a specific number of bytes and after this call, a sequence of read calls may follow. The offsets given as arguments are inclusive. For example, if we call this method with arguments 0, 2, 1, 7, it will read in a buffer the contents of the underlying file from the third bit of the first byte to the last bit of the second byte.- Parameters:
startByteOffset
- the starting byte to read fromstartBitOffset
- the bit offset in the starting byte- Returns:
- Returns the BitIn object to use to read that data
- Throws:
java.io.IOException
-
-