Package org.terrier.compression.bit
Class BitFileChannel
- java.lang.Object
-
- org.terrier.compression.bit.BitFileBuffered
-
- org.terrier.compression.bit.BitFileChannel
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,BitInSeekable
public class BitFileChannel extends BitFileBuffered
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
BitFileChannel.FileChannelBitInBuffered
-
Nested classes/interfaces inherited from class org.terrier.compression.bit.BitFileBuffered
BitFileBuffered.BitInBuffered
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.channels.FileChannel
_channel
-
Fields inherited from class org.terrier.compression.bit.BitFileBuffered
buffer_size, DEFAULT_BUFFER_LENGTH, fileSize, logger
-
-
Constructor Summary
Constructors Constructor Description BitFileChannel(java.io.File _file)
BitFileChannel(java.io.File _file, int bufSize)
BitFileChannel(java.lang.String filename)
BitFileChannel(java.lang.String filename, int bufSize)
BitFileChannel(RandomDataInput f)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BitFileChannel
of(BitFileBuffered old)
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.-
Methods inherited from class org.terrier.compression.bit.BitFileBuffered
close
-
-
-
-
Constructor Detail
-
BitFileChannel
public BitFileChannel(java.io.File _file, int bufSize)
-
BitFileChannel
public BitFileChannel(java.io.File _file)
-
BitFileChannel
public BitFileChannel(RandomDataInput f)
-
BitFileChannel
public BitFileChannel(java.lang.String filename, int bufSize)
-
BitFileChannel
public BitFileChannel(java.lang.String filename)
-
-
Method Detail
-
of
public static BitFileChannel of(BitFileBuffered old)
-
readReset
public BitIn readReset(long startByteOffset, byte startBitOffset, long endByteOffset, byte endBitOffset)
Description copied from class:BitFileBuffered
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
- Overrides:
readReset
in classBitFileBuffered
- 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
-
readReset
public BitIn readReset(long startByteOffset, byte startBitOffset)
Description copied from class:BitFileBuffered
Reads from the file from a specific offset. After this call, a sequence of read calls may follow.- Specified by:
readReset
in interfaceBitInSeekable
- Overrides:
readReset
in classBitFileBuffered
- 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
-
-