Package de.intarsys.tools.reader
Class LogReader
- java.lang.Object
-
- java.io.Reader
-
- java.io.FilterReader
-
- de.intarsys.tools.reader.LogReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
public class LogReader extends java.io.FilterReaderA reader that logs any char read.The reader is piped in the reading process, any characters read are written to an associated writer object.
Client -> LogReader -> Reader -> Source | v Writertodo make closing of associated writer configurable
-
-
Constructor Summary
Constructors Constructor Description LogReader(java.io.Reader in, java.io.Writer w)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.io.WritergetLog()intread()intread(char[] cbuf, int off, int len)Read characters into a portion of an array.voidsetLog(java.io.Writer newLog)
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterReader- Throws:
java.io.IOException
-
getLog
public java.io.Writer getLog()
-
read
public int read() throws java.io.IOException- Overrides:
readin classjava.io.FilterReader- Throws:
java.io.IOException
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOExceptionRead characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.- Overrides:
readin classjava.io.FilterReader- Parameters:
cbuf- Destination bufferoff- Offset at which to start storing characterslen- Maximum number of characters to read- Returns:
- The number of characters read, or -1 if the end of the stream has been reached
- Throws:
java.io.IOException- If an I/O error occurs
-
setLog
public void setLog(java.io.Writer newLog)
-
-