edu.rice.cs.plt.io
Class LinkedInputAndOutputStream

java.lang.Object
  extended by edu.rice.cs.plt.io.LinkedInputAndOutputStream

public class LinkedInputAndOutputStream
extends java.lang.Object

Coordinates reading and writing from the same source. Ensures that the given OutputStream will never write past the location of the InputStream, potentially corrupting its contents. When the OutputStream needs to write more bytes than have been read, a buffer is used to store the bytes in between. In order to take advantage of these linking features, all interaction with the user-provided InputStream and OutputStream must subsequently take place via the results of inputStream() and outputStream(), respectively.


Constructor Summary
LinkedInputAndOutputStream(java.io.InputStream in, java.io.OutputStream out)
          Link in and out.
 
Method Summary
 DirectInputStream inputStream()
           
 DirectOutputStream outputStream()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedInputAndOutputStream

public LinkedInputAndOutputStream(java.io.InputStream in,
                                  java.io.OutputStream out)
Link in and out. Assumes that in and out are newly created, or at least that their underlying cursors point to the same place. Also assumes that no further direct interaction with in or out will occur.

Method Detail

inputStream

public DirectInputStream inputStream()

outputStream

public DirectOutputStream outputStream()