|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.compression.BitFileInMemory
public class BitFileInMemory
Class which enables a bit compressed file to be read wholly into memory and accessed from there with low latency. This file cannot handle files larger than Integer.MAX_VALUE (2GB)
Field Summary | |
---|---|
protected byte[] |
inBuffer
buffer in memory for the entire compressed file |
protected static org.apache.log4j.Logger |
logger
The logger used |
Constructor Summary | |
---|---|
BitFileInMemory(byte[] buffer)
Create an object using the specified data as the compressed data |
|
BitFileInMemory(java.io.InputStream is,
long length)
Loads the entire specified inputstream into memory. |
|
BitFileInMemory(java.lang.String filename)
Loads the entire file represented by filename into memory |
Method Summary | |
---|---|
void |
close()
Close this object. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger logger
protected final byte[] inBuffer
Constructor Detail |
---|
public BitFileInMemory(java.lang.String filename) throws java.io.IOException
filename
- Location of bit file to read into memory
java.io.IOException
- if anything goes wrong reading the filepublic BitFileInMemory(java.io.InputStream is, long length) throws java.io.IOException
is
- InputStream containing the compressed bitfilelength
- Expected length of the input stream
java.io.IOException
- if anything goes wrong reading the inputstreampublic BitFileInMemory(byte[] buffer)
Method Detail |
---|
public BitIn readReset(long startByteOffset, byte startBitOffset, long endByteOffset, byte endBitOffset)
readReset
in interface BitInSeekable
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.
public BitIn readReset(long startByteOffset, byte startBitOffset)
readReset
in interface BitInSeekable
startByteOffset
- the starting byte to read fromstartBitOffset
- the bit offset in the starting byte
public void close()
close
in interface java.io.Closeable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |