Package org.aksw.iguana.commons.io
Class ByteArrayListOutputStream
java.lang.Object
java.io.OutputStream
org.aksw.iguana.commons.io.ReversibleOutputStream
org.aksw.iguana.commons.io.ByteArrayListOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An OutputStream that writes to a list of byte arrays.
The buffers have a minimum size.
If a write operation is smaller than the minimum size, the data is stored in a separate buffer.
This buffer will be filled up by subsequent writings to the minimum size before another buffer is created.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ByteArrayListOutputStream with a minimum buffer size of 4096 bytes.ByteArrayListOutputStream(int minBufferSize) Creates a new ByteArrayListOutputStream with the given minimum buffer size. -
Method Summary
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Constructor Details
-
ByteArrayListOutputStream
public ByteArrayListOutputStream()Creates a new ByteArrayListOutputStream with a minimum buffer size of 4096 bytes. -
ByteArrayListOutputStream
public ByteArrayListOutputStream(int minBufferSize) Creates a new ByteArrayListOutputStream with the given minimum buffer size.- Parameters:
minBufferSize- the minimum buffer size
-
-
Method Details
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
size
public long size()- Specified by:
sizein classReversibleOutputStream
-
getBuffers
Returns the list of buffers. The list does not contain the current buffer. If the stream is closed, the current buffer is trimmed to the actual size and then added to the list.- Returns:
- the list of buffers
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
toInputStream
- Specified by:
toInputStreamin classReversibleOutputStream
-