|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream uk.ac.gla.terrier.compression.MemoryLinkedOutputStream
public class MemoryLinkedOutputStream
This class implements an OutputStream that writes everything in memory, and never flushes the data to disk. It uses a Linked list of byte[] arrays, probably of different sizes, to keep track of the new allocations. This class needs more memory (the pointers) than the MemoryOutputStream class, but it avoids the reallocation of arrays in memory.
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default size of the internal buffer in bytes |
Constructor Summary | |
---|---|
MemoryLinkedOutputStream()
Instanciates a MemoryLinkedOutputStream with the buffer size set to DEFAULT_BUFFER_SIZE |
|
MemoryLinkedOutputStream(int bufferSize)
Instanciates a MemoryLinkedOutputStream specifying the buffer size. |
Method Summary | |
---|---|
void |
beginRead()
Sets the structure for reading |
void |
flush()
Empty method |
byte[] |
getBuffer()
|
MemoryLinkedOutputStream |
getNext()
|
int |
getPos()
|
boolean |
isNext()
|
void |
nextBuffer()
Moves the pointer to the next buffer (reading) |
void |
write(int b)
Writes a byte into the current buffer. |
Methods inherited from class java.io.OutputStream |
---|
close, write, write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public MemoryLinkedOutputStream()
public MemoryLinkedOutputStream(int bufferSize)
bufferSize
- int size of the first bufferMethod Detail |
---|
public MemoryLinkedOutputStream getNext()
public int getPos()
public void beginRead()
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
b
- the byte to write
java.io.IOException
- if an I/O error occurs.public byte[] getBuffer()
public boolean isNext()
public void nextBuffer()
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |