public class LoggingReader
extends java.io.BufferedReader
BufferedReader with logging capability.
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
DEP_LIST
Class dependencies
|
static java.lang.String |
VERSION
Class version
|
Constructor and Description |
---|
LoggingReader(java.io.InputStream in,
int sz,
java.io.PrintWriter logDest,
boolean setLogging)
Create a new LoggingReader from an InputStream.
|
LoggingReader(java.io.InputStream in,
java.io.PrintWriter logDest,
boolean setLogging)
Create a new LoggingReader from an InputStream.
|
LoggingReader(java.io.Reader in,
int sz,
java.io.PrintWriter logDest,
boolean setLogging)
Create a new LoggingReader from a Reader.
|
LoggingReader(java.io.Reader in,
int sz,
java.io.PrintWriter logDest,
boolean setLogging,
java.lang.String id)
Create a new LoggingReader from a Reader.
|
LoggingReader(java.io.Reader in,
java.io.PrintWriter logDest,
boolean setLogging)
Create a new LoggingReader from a Reader.
|
LoggingReader(java.io.Reader in,
java.io.PrintWriter logDest,
boolean setLogging,
java.lang.String id)
Create a new LoggingReader from a Reader.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getTimestamp()
Get a time-stamp string with the current time.
|
boolean |
isTimestamping() |
void |
mark(int readAheadLimit)
Mark the present position in the stream.
|
int |
read()
Read a single character.
|
int |
read(char[] cbuf,
int off,
int len)
Read characters into a portion of an array.
|
java.lang.String |
readLine()
Read a line of text.
|
void |
reset()
Reset the stream to the most recent mark.
|
void |
setTimestamp(boolean timestamp) |
public static final java.lang.String VERSION
public static final java.lang.String[] DEP_LIST
public LoggingReader(java.io.Reader in, java.io.PrintWriter logDest, boolean setLogging)
in
- The underlying ReaderlogDest
- The log destination for I/O tracingsetLogging
- If true, I/O tracing is turned onpublic LoggingReader(java.io.InputStream in, java.io.PrintWriter logDest, boolean setLogging)
in
- The underlying InputStreamlogDest
- The log destination for I/O tracingsetLogging
- If true, I/O tracing is turned onpublic LoggingReader(java.io.Reader in, java.io.PrintWriter logDest, boolean setLogging, java.lang.String id)
in
- The underlying ReaderlogDest
- The log destination for I/O tracingsetLogging
- If true, I/O tracing is turned onid
- Source indetifier to include in log outputpublic LoggingReader(java.io.Reader in, int sz, java.io.PrintWriter logDest, boolean setLogging)
in
- The underlying Readersz
- The input buffer sizelogDest
- The log destination for I/O tracingsetLogging
- If true, I/O tracing is turned onpublic LoggingReader(java.io.InputStream in, int sz, java.io.PrintWriter logDest, boolean setLogging)
in
- The underlying InputStreamsz
- The input buffer sizelogDest
- The log destination for I/O tracingsetLogging
- If true, I/O tracing is turned onpublic LoggingReader(java.io.Reader in, int sz, java.io.PrintWriter logDest, boolean setLogging, java.lang.String id)
in
- The underlying Readersz
- The input buffer sizelogDest
- The log destination for I/O tracingsetLogging
- If true, I/O tracing is turned onid
- Source indetifier to include in log outputpublic static java.lang.String getTimestamp()
public boolean isTimestamping()
public void setTimestamp(boolean timestamp)
public int read() throws java.io.IOException
read
in class java.io.BufferedReader
java.io.IOException
- If an I/O error occurspublic int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.BufferedReader
cbuf
- Destination bufferoff
- Offset at which to start storing characterslen
- Maximum number of characters to readjava.io.IOException
- If an I/O error occurspublic java.lang.String readLine() throws java.io.IOException
readLine
in class java.io.BufferedReader
java.io.IOException
- If an I/O error occurspublic void mark(int readAheadLimit) throws java.io.IOException
mark
in class java.io.BufferedReader
readAheadLimit
- Limit on the number of characters that may be
read while still preserving the markjava.io.IOException
- If an I/O error occursjava.lang.IllegalArgumentException
- If readAheadLimit is less than 0public void reset() throws java.io.IOException
reset
in class java.io.BufferedReader
java.io.IOException
- If an I/O error occurs