org.apache.activemq.util
Class ByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.activemq.util.ByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable

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
ByteArrayOutputStream()
           
ByteArrayOutputStream(int capacity)
           
 
Method Summary
 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, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayOutputStream

public ByteArrayOutputStream()

ByteArrayOutputStream

public ByteArrayOutputStream(int capacity)
Method Detail

write

public void write(int b)
Specified by:
write in class OutputStream

write

public void write(byte[] b,
                  int off,
                  int len)
Overrides:
write in class OutputStream

reset

public void reset()

toByteSequence

public ByteSequence toByteSequence()

toByteArray

public byte[] toByteArray()

size

public int size()

endsWith

public boolean endsWith(byte[] array)


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.