Class BufferOutputStream
java.lang.Object
java.io.OutputStream
org.fusesource.hawtbuf.BufferOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Very similar to the java.io.ByteArrayOutputStream but this version
is not thread safe and the resulting data is returned in a Buffer
to avoid an extra byte[] allocation. It also does not re-grow it's
internal buffer.
- Author:
- Hiram Chirino
-
Constructor Summary
ConstructorsConstructorDescriptionBufferOutputStream(byte[] buffer) BufferOutputStream(int size) BufferOutputStream(Buffer data) -
Method Summary
Methods inherited from class OutputStream
close, flush, write
-
Constructor Details
-
BufferOutputStream
public BufferOutputStream(int size) -
BufferOutputStream
public BufferOutputStream(byte[] buffer) -
BufferOutputStream
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
getNextBuffer
- Throws:
IOException
-
reset
public void reset() -
toBuffer
-
toByteArray
public byte[] toByteArray() -
size
public int size()
-