Package org.terrier.compression.bit
Class BitFileInMemoryLarge
- java.lang.Object
-
- org.terrier.compression.bit.BitFileInMemoryLarge
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,BitInSeekable
public class BitFileInMemoryLarge extends java.lang.Object implements BitInSeekable
Allows access to bit compressed files that are loaded entirely into memory. Implements a BitInSeekable that uses RandomDataInputMemory as a backing store. Can handle data files larger than those handled by BitFileInMemory (whose limit is Integer.MAX_VALUE).- Since:
- 3.0
- Author:
- Craig Macdonald
-
-
Constructor Summary
Constructors Constructor Description BitFileInMemoryLarge(java.lang.String filename)
load compressed file into memoryBitFileInMemoryLarge(RandomDataInputMemory _rdim)
constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
BitIn
readReset(long startByteOffset, byte startBitOffset)
Reads from the file from a specific offset.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.
-
-
-
Constructor Detail
-
BitFileInMemoryLarge
public BitFileInMemoryLarge(RandomDataInputMemory _rdim) throws java.io.IOException
constructor- Parameters:
_rdim
-- Throws:
java.io.IOException
-
BitFileInMemoryLarge
public BitFileInMemoryLarge(java.lang.String filename) throws java.io.IOException
load compressed file into memory- Parameters:
filename
-- Throws:
java.io.IOException
-
-
Method Detail
-
readReset
public 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.- Specified by:
readReset
in interfaceBitInSeekable
- 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
public BitIn readReset(long startByteOffset, byte startBitOffset) throws java.io.IOException
Reads from the file from a specific offset. After this call, a sequence of read calls may follow.- Specified by:
readReset
in interfaceBitInSeekable
- 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
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-