jautil
Class CopiableBytesStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by jautil.CopiableBytesStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class CopiableBytesStream
extends java.io.ByteArrayOutputStream

A CopiableBytesStream is a ByteArrayOutputStream equipped with methods allowing the array contents to be copied to some other output-stream or to a Java ARP output-stream.


Constructor Summary
CopiableBytesStream(int capacity)
          Constructs a new instance with the specified initial capacity in bytes, with doszpfx defaulting to true.
CopiableBytesStream(int capacity, boolean doszpfx)
          Constructs a new instance with the specified initial capacity in bytes, and whose output methods will or will not prefix the data with a little-endian integer giving the data-block size in bytes, as determined by the second parameter.
 
Method Summary
 void copyData(JAOutputStream jouts)
          Copies the data from this stream's backing array to the specified Java ARP output stream.
 void copyData(java.io.OutputStream outs)
          Copies the data from this stream's backing array to the specified output stream.
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CopiableBytesStream

public CopiableBytesStream(int capacity)
Constructs a new instance with the specified initial capacity in bytes, with doszpfx defaulting to true.


CopiableBytesStream

public CopiableBytesStream(int capacity,
                           boolean doszpfx)
Constructs a new instance with the specified initial capacity in bytes, and whose output methods will or will not prefix the data with a little-endian integer giving the data-block size in bytes, as determined by the second parameter.

Method Detail

copyData

public void copyData(JAOutputStream jouts)
              throws java.io.IOException
Copies the data from this stream's backing array to the specified Java ARP output stream.

Throws:
java.io.IOException

copyData

public void copyData(java.io.OutputStream outs)
              throws java.io.IOException
Copies the data from this stream's backing array to the specified output stream.

Throws:
java.io.IOException