|
Terrier IR Platform 1.1.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.gla.terrier.compression.BitOutputStream
public class BitOutputStream
This class creates sequentially a BitFile file from a stream.
BitFile
Constructor Summary | |
---|---|
BitOutputStream(java.io.File file)
Constructs an instance of the class for a given file |
|
BitOutputStream(java.io.OutputStream is)
Constructs an instance of the class for a given stream. |
|
BitOutputStream(java.lang.String filename)
Constructs an instance of the class for a given filename |
Method Summary | |
---|---|
void |
close()
Flushes and closes the stream. |
void |
flush()
Flush the underlying DataOutputStream to disk |
byte |
getBitOffset()
Returns the bit offset in the last byte. |
long |
getByteOffset()
Returns the byte offset of the stream. |
void |
writeBinary(int bitsToWrite,
int n)
Writes a binary integer to the already read buffer. |
void |
writeGamma(int n)
Writes an gamma encoded integer to the stream. |
void |
writeUnary(int n)
Writes a unary encoded integer to the stream. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitOutputStream(java.io.OutputStream is) throws java.io.IOException
is
- java.io.OutputStream the underlying input stream
java.io.IOException
- if an I/O error occurspublic BitOutputStream(java.lang.String filename) throws java.io.IOException
filename
- java.lang.String the name of the undelying file
java.io.IOException
- if an I/O error occurspublic BitOutputStream(java.io.File file) throws java.io.IOException
file
- java.io.File the underlying file
java.io.IOException
- if an I/O error occursMethod Detail |
---|
public void writeBinary(int bitsToWrite, int n) throws java.io.IOException
bitsToWrite
- the number of bits to use for encodingn
- the integer
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
- if an I/O error occurspublic void writeUnary(int n) throws java.io.IOException
n
- int the integer to write.
java.io.IOException
- if an I/O error occurspublic void writeGamma(int n) throws java.io.IOException
n
- The integer to be encoded and saved in the buffer.
java.io.IOException
- if an I/O error occurspublic long getByteOffset()
public byte getBitOffset()
public void flush()
|
Terrier IR Platform 1.1.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |