de.intarsys.tools.stream
Class FastByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by de.intarsys.tools.stream.FastByteArrayOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class FastByteArrayOutputStream
extends java.io.OutputStream


Field Summary
protected  byte[] buf
          The buffer where data is stored.
protected  int count
          The number of valid bytes in the buffer.
 
Constructor Summary
FastByteArrayOutputStream()
           
FastByteArrayOutputStream(int size)
           
 
Method Summary
 byte[] getBytes()
           
 void reset()
           
 int size()
           
 byte[] toByteArray()
           
 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
 

Field Detail

buf

protected byte[] buf
The buffer where data is stored.


count

protected int count
The number of valid bytes in the buffer.

Constructor Detail

FastByteArrayOutputStream

public FastByteArrayOutputStream()

FastByteArrayOutputStream

public FastByteArrayOutputStream(int size)
Method Detail

getBytes

public byte[] getBytes()

reset

public void reset()

size

public int size()

toByteArray

public byte[] toByteArray()

write

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

write

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