org.fusesource.hawtbuf
Class ByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.fusesource.hawtbuf.ByteArrayOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class ByteArrayOutputStream
extends java.io.OutputStream

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.

Author:
Hiram Chirino

Constructor Summary
ByteArrayOutputStream()
           
ByteArrayOutputStream(int capacity)
           
 
Method Summary
 void reset()
           
 int size()
           
 Buffer toBuffer()
           
 byte[] toByteArray()
           
 void write(Buffer b)
           
 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 java.io.OutputStream

write

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

write

public void write(Buffer b)

reset

public void reset()

toBuffer

public Buffer toBuffer()

toByteArray

public byte[] toByteArray()

size

public int size()


Copyright © 2010-2011 FuseSource, Corp.. All Rights Reserved.