DCT Lightfoot v3 API specification

java.io
Class ByteArrayOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.ByteArrayOutputStream
All Implemented Interfaces:
Writable

public class ByteArrayOutputStream
extends OutputStream

An output stream that stores into a byte array


Field Summary
protected  byte[] buf
          The buffer to store data in
protected  int count
          The number of bytes in the buffer
 
Constructor Summary
ByteArrayOutputStream()
          Create a new output stream
ByteArrayOutputStream(int size)
          Create a new output stream of the size
 
Method Summary
 void close()
          Close the stream
 void reset()
          Reset the stream
 int size()
          Return the size of the stream
 byte[] toByteArray()
          Create a new array with the contents
 java.lang.String toString()
          Convert to a string
 void write(byte[] b, int off, int len)
          Write a byte array to the array
 void write(int b)
          Write to the array
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buf

protected byte[] buf
The buffer to store data in


count

protected int count
The number of bytes in the buffer

Constructor Detail

ByteArrayOutputStream

public ByteArrayOutputStream()
                      throws IllegalArgumentException
Create a new output stream


ByteArrayOutputStream

public ByteArrayOutputStream(int size)
                      throws IllegalArgumentException
Create a new output stream of the size

Parameters:
size - The size
Throws:
IllegalArgumentException - if the size is negative
Method Detail

close

public void close()
           throws IOException
Close the stream

Overrides:
close in class OutputStream
Throws:
IOException

reset

public void reset()
Reset the stream


size

public int size()
Return the size of the stream

Returns:
the size

toByteArray

public byte[] toByteArray()
Create a new array with the contents

Returns:
the array

toString

public java.lang.String toString()
Convert to a string

Overrides:
toString in class Object
Returns:
the string

write

public void write(int b)
Write to the array

Specified by:
write in interface Writable
Specified by:
write in class OutputStream
Parameters:
b - The byte

write

public void write(byte[] b,
                  int off,
                  int len)
Write a byte array to the array

Specified by:
write in interface Writable
Overrides:
write in class OutputStream
Parameters:
b - The array
off - The offset
len - The length

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification