org.apache.kahadb.util
Class ByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.kahadb.util.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 ByteSequence to avoid an extra byte[] allocation.


Constructor Summary
ByteArrayOutputStream()
           
ByteArrayOutputStream(int capacity)
           
 
Method Summary
 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 java.io.OutputStream

write

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

reset

public void reset()

toByteSequence

public ByteSequence toByteSequence()

toByteArray

public byte[] toByteArray()

size

public int size()


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