Package org.apache.activemq.util
Class ByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.activemq.util.ByteArrayOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class ByteArrayOutputStream extends OutputStream
Very similar to the java.io.ByteArrayOutputStream but this version is not thread safe and the resulting data is returned in a ByteSequence to avoid an extra byte[] allocation.
-
-
Constructor Summary
Constructors Constructor Description ByteArrayOutputStream()
ByteArrayOutputStream(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
endsWith(byte[] array)
void
reset()
int
size()
byte[]
toByteArray()
ByteSequence
toByteSequence()
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write
-
-
-
-
Method Detail
-
write
public void write(int b)
- Specified by:
write
in classOutputStream
-
write
public void write(byte[] b, int off, int len)
- Overrides:
write
in classOutputStream
-
reset
public void reset()
-
toByteSequence
public ByteSequence toByteSequence()
-
toByteArray
public byte[] toByteArray()
-
size
public int size()
-
endsWith
public boolean endsWith(byte[] array)
-
-