org.terrier.compression
Class BitFileInMemoryLarge

java.lang.Object
  extended by org.terrier.compression.BitFileInMemoryLarge
All Implemented Interfaces:
java.io.Closeable, 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:
craigm

Constructor Summary
BitFileInMemoryLarge(RandomDataInputMemory _rdim)
          constructor
BitFileInMemoryLarge(java.lang.String filename)
          load compressed file into memory
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface BitInSeekable
Parameters:
startByteOffset - the starting byte to read from
startBitOffset - the bit offset in the starting byte
endByteOffset - the ending byte
endBitOffset - 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 interface BitInSeekable
Parameters:
startByteOffset - the starting byte to read from
startBitOffset - 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 interface java.io.Closeable
Throws:
java.io.IOException


Terrier 3.5. Copyright © 2004-2011 University of Glasgow