com.evanmclean.evlib.io
Class ByteArrayInputOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by com.evanmclean.evlib.io.ByteArrayInputOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class ByteArrayInputOutputStream
extends ByteArrayOutputStream

A byte array output stream which you can then directly get an input stream for without the overhead of copying the byte array. Input stream behaviour may get screwy if you write to the output stream, and particularly if you call ByteArrayOutputStream.reset() after calling getInputStream().


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
ByteArrayInputOutputStream()
           
ByteArrayInputOutputStream(int size)
           
 
Method Summary
 ByteArrayInputStream getInputStream()
          Get a byte array input stream based on the current byte buffer for the 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteArrayInputOutputStream

public ByteArrayInputOutputStream()

ByteArrayInputOutputStream

public ByteArrayInputOutputStream(int size)
Method Detail

getInputStream

public ByteArrayInputStream getInputStream()
Get a byte array input stream based on the current byte buffer for the output stream. Behaviour of the input stream may get screwy if you write to the output stream, and particularly if you call ByteArrayOutputStream.reset() after calling this method.

Returns:
A byte array input stream.