Package org.apache.activemq.protobuf
Class BufferOutputStream
java.lang.Object
java.io.OutputStream
org.apache.activemq.protobuf.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.
-
Constructor Summary
ConstructorsConstructorDescriptionBufferOutputStream
(byte[] buffer) BufferOutputStream
(int size) BufferOutputStream
(Buffer data) -
Method Summary
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write
-
Constructor Details
-
BufferOutputStream
public BufferOutputStream(int size) -
BufferOutputStream
public BufferOutputStream(byte[] buffer) -
BufferOutputStream
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
getNextBuffer
- Throws:
IOException
-
reset
public void reset() -
toBuffer
-
toByteArray
public byte[] toByteArray() -
size
public int size()
-