Class prominence.io.ResetByteArrayOutputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prominence.io.ResetByteArrayOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.ByteArrayOutputStream
                   |
                   +----prominence.io.ResetByteArrayOutputStream

public class ResetByteArrayOutputStream
extends ByteArrayOutputStream
A ByteArrayOutputStream that automatically resets after any operation that extracts the buffer contents.

Constructor Index

 o ResetByteArrayOutputStream()
Creates a new ResetByteArrayOutputStream with the default initial buffer size.
 o ResetByteArrayOutputStream(int)
Creates a new ResetByteArrayOutputStream with a specified initial buffer size.

Method Index

 o toByteArray()
Extracts the contents of the buffer as an array of bytes, and then resets the internal buffer.
 o writeTo(OutputStream)
Writes the contents of the buffer to a specified OutputStream and then resets the internal buffer.

Constructors

 o ResetByteArrayOutputStream
  public ResetByteArrayOutputStream()
Creates a new ResetByteArrayOutputStream with the default initial buffer size.
 o ResetByteArrayOutputStream
  public ResetByteArrayOutputStream(int size)
Creates a new ResetByteArrayOutputStream with a specified initial buffer size.
Parameters:
size - The initial buffer size

Methods

 o toByteArray
  public byte[] toByteArray()
Extracts the contents of the buffer as an array of bytes, and then resets the internal buffer.
Returns:
A copy of the buffer contents.
Overrides:
toByteArray in class ByteArrayOutputStream
See Also:
toString
 o writeTo
  public void writeTo(OutputStream out) throws IOException
Writes the contents of the buffer to a specified OutputStream and then resets the internal buffer.
Parameters:
out - The OutputStream to which the buffer should be written
Throws: IOException
Occurs if there is a problem writing the buffer to the stream.
Overrides:
writeTo in class ByteArrayOutputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index