uka.transport
Class MemoryOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byuka.transport.MemoryOutputStream

public final class MemoryOutputStream
extends java.io.OutputStream

An output stream that writes into memory.

Author:
Bernhard Haumacher

Field Summary
private  byte[] buffer
           
private  int count
          number of valid byte in the buffer
 
Constructor Summary
MemoryOutputStream()
          Create the stream with a default buffer size of 512 bytes.
MemoryOutputStream(int size)
           
 
Method Summary
 byte[] getBuffer()
           
 void reset()
           
 int size()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

private byte[] buffer

count

private int count
number of valid byte in the buffer

Constructor Detail

MemoryOutputStream

public MemoryOutputStream()
Create the stream with a default buffer size of 512 bytes.


MemoryOutputStream

public MemoryOutputStream(int size)
Method Detail

write

public void write(int b)

write

public void write(byte[] b)

write

public void write(byte[] b,
                  int off,
                  int len)

reset

public void reset()

size

public int size()

getBuffer

public byte[] getBuffer()