Package org.terrier.compression.bit
Class MemorySBOS
- java.lang.Object
-
- org.terrier.compression.bit.BitOutputStream
-
- org.terrier.compression.bit.BitByteOutputStream
-
- org.terrier.compression.bit.MemorySBOS
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,BitOut
public class MemorySBOS extends BitByteOutputStream
This class extends the BitByteOutputStream, so it provides the compression writing functions, but uses a MemoryOutputStream as an underlying OutputStream, so it is needed to be flushed to disk separately. It uses BitByteOutputStream and not BitOutputStream because the MemoryOutputStream class has already its own buffer (to keep everything in memory), and extra buffering is inadequate.- Author:
- Roi Blanco
-
-
Field Summary
Fields Modifier and Type Field Description protected MemoryOutputStream
mos
The underlying MemoryOutputStream-
Fields inherited from class org.terrier.compression.bit.BitByteOutputStream
byteToWrite
-
Fields inherited from class org.terrier.compression.bit.BitOutputStream
bitOffset, buffer, bufferPointer, bufferSize, byteOffset, DEFAULT_SIZE, dos, logger
-
-
Constructor Summary
Constructors Constructor Description MemorySBOS()
Constructor for the class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemoryOutputStream
getMOS()
int
getSize()
Return the amount of memory bytes consumed by the underlying bufferjava.lang.String
toString()
Writes the underlying MemoryOutputStream in String format.-
Methods inherited from class org.terrier.compression.bit.BitByteOutputStream
close, getBitOffset, getByteOffset, getByteToWrite, pad, writeInt, writeUnary
-
Methods inherited from class org.terrier.compression.bit.BitOutputStream
append, append, flush, padAndFlush, writeBinary, writeDelta, writeGamma, writeGolomb, writeInterpolativeCode, writeMinimalBinary, writeSkewedGolomb
-
-
-
-
Field Detail
-
mos
protected MemoryOutputStream mos
The underlying MemoryOutputStream
-
-
Method Detail
-
toString
public java.lang.String toString()
Writes the underlying MemoryOutputStream in String format.- Overrides:
toString
in classjava.lang.Object
-
getMOS
public MemoryOutputStream getMOS()
- Returns:
- The underlying MemoryOutputStream.
-
getSize
public int getSize()
Return the amount of memory bytes consumed by the underlying buffer
-
-