java.io
Class ByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream


public class ByteArrayOutputStream
extends OutputStream

Output stream that writes to a byte[].

Compliance: CLDC: 1.0 complete

Compliance: J2SE: 1.4 complete


Field Summary
protected  byte[] buf
           
protected  int count
           
 
Constructor Summary
ByteArrayOutputStream()
           
ByteArrayOutputStream(int size)
           
 
Method Summary
 void close()
           
 void flush()
           
 void reset()
           
 int size()
           
 byte[] toByteArray()
           
 String toString()
           
 String toString(int hibyte)
           
 String toString(String enc)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeTo(OutputStream out)
           
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buf

protected byte[] buf

count

protected int count
Constructor Detail

ByteArrayOutputStream

public ByteArrayOutputStream()

ByteArrayOutputStream

public ByteArrayOutputStream(int size)
Method Detail

close

public void close()
           throws IOException
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Overrides:
flush in class OutputStream
Throws:
IOException

reset

public void reset()

size

public int size()

toByteArray

public byte[] toByteArray()

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(int hibyte)

toString

public String toString(String enc)
                throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

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

writeTo

public void writeTo(OutputStream out)
             throws IOException
Throws:
IOException