edu.rice.cs.plt.io
Class LinkedReaderAndWriter

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

public class LinkedReaderAndWriter
extends java.lang.Object

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


Constructor Summary
LinkedReaderAndWriter(java.io.Reader r, java.io.Writer w)
          Link r and w.
 
Method Summary
 DirectReader reader()
           
 DirectWriter writer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedReaderAndWriter

public LinkedReaderAndWriter(java.io.Reader r,
                             java.io.Writer w)
Link r and w. Assumes that r and w are newly created, or at least that their underlying cursors point to the same place. Also assumes that no further direct interaction with r or w will occur.

Method Detail

reader

public DirectReader reader()

writer

public DirectWriter writer()