|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
java.io.BufferedReader
edu.toronto.cs.util.TeeBufferedReader
public class TeeBufferedReader
Reads text from a Reader, copying characters read to a Writer.
Inspired by the Unix tee command.
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
TeeBufferedReader(java.io.Reader source)
Creates a new TeeBufferedReader instance specifying
a source only |
|
TeeBufferedReader(java.io.Reader source,
int sz)
Creates a new TeeBufferedReader instance. |
|
TeeBufferedReader(java.io.Reader source,
java.io.Writer copy)
Creates a new TeeBufferedReader instance specifying
source and logFile. |
|
TeeBufferedReader(java.io.Reader source,
java.io.Writer copy,
java.lang.String prefix)
Constructs a TeeBufferedReader with the specified Reader, Writer and prefix. |
Method Summary | |
---|---|
void |
close()
Writes the content of outputBuffer to the logFile and closes the underlying reader and writer. |
static void |
main(java.lang.String[] args)
|
void |
prefixOn()
Makes it so that the next character read is copied out with the prefix prepended. |
int |
read()
reads a character from the Reader and sends it to be written to the logFile |
java.lang.String |
readLine()
reads a line from reader and writes it to the logFile. |
Methods inherited from class java.io.BufferedReader |
---|
mark, markSupported, read, ready, reset, skip |
Methods inherited from class java.io.Reader |
---|
read, read |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TeeBufferedReader(java.io.Reader source, java.io.Writer copy)
TeeBufferedReader
instance specifying
source and logFile.
source
- a Reader
with the information to be loggedcopy
- a Writer
which creates a log filepublic TeeBufferedReader(java.io.Reader source)
TeeBufferedReader
instance specifying
a source only
source
- a Reader
with the information to be loggedpublic TeeBufferedReader(java.io.Reader source, int sz)
TeeBufferedReader
instance.
source
- a Reader
with the information to be loggedx
- an int
public TeeBufferedReader(java.io.Reader source, java.io.Writer copy, java.lang.String prefix)
source
- a Reader
with the information to be loggedcopy
- a Writer
which creates a log of all information.prefix
- a String
that should be added before each
line of CVC outputMethod Detail |
---|
public void prefixOn()
public int read() throws java.io.IOException
read
in class java.io.BufferedReader
int
a character that was read
java.io.IOException
- if an error occurspublic java.lang.String readLine() throws java.io.IOException
readLine
in class java.io.BufferedReader
String
line that was read
java.io.IOException
- if an error occurspublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.BufferedReader
java.io.IOException
- if an I/O error occurspublic static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |