public class DelegatingReader
extends java.io.Reader
| Modifier and Type | Field and Description |
|---|---|
private boolean |
inRead1
Stores if we are in a read method with 1 parameter (avoid double
recording).
|
private boolean |
inRead3
Stores if we are in a read method with 3 parameters (avoid double
recording).
|
private java.io.Reader |
reader
Stores the reader to delegate to.
|
private java.lang.String |
recId
Stores the recorder id to aggregate the notifications for.
|
private StreamType |
type
Stores the stream type.
|
| Constructor and Description |
|---|
DelegatingReader(java.io.Reader reader,
StreamType type)
Creates a new delegating reader.
|
DelegatingReader(java.io.Reader reader,
StreamType type,
java.lang.String recId)
Creates a new delegating reader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the reader.
|
void |
mark(int readAheadLimit)
Marks the present position in the stream.
|
boolean |
markSupported()
Tells whether this stream supports the mark() operation.
|
int |
read()
Reads a char from a stream.
|
int |
read(char[] buffer)
Reads chars into
buffer, at maximum up to the length of the
buffer. |
int |
read(char[] buffer,
int off,
int len)
Reads at maximum
len chars into buffer starting
at off. |
boolean |
ready()
Tells whether this stream is ready to be read.
|
void |
reset()
Resets the stream.
|
long |
skip(long number)
Skips characters.
|
private java.io.Reader reader
private boolean inRead3
private boolean inRead1
private StreamType type
private java.lang.String recId
public DelegatingReader(java.io.Reader reader,
StreamType type)
reader - the reader to delegate the operations totype - the type of the streampublic DelegatingReader(java.io.Reader reader,
StreamType type,
java.lang.String recId)
reader - the reader to delegate the operations totype - the type of the streamrecId - the recorder id to aggregate the notifications forpublic int read()
throws java.io.IOException
read in class java.io.Readerjava.io.IOException - in case of any I/O error or problempublic int read(char[] buffer)
throws java.io.IOException
buffer, at maximum up to the length of the
buffer.read in class java.io.Readerbuffer - the char buffer to be modifiedjava.io.IOException - in case of I/O reading errorspublic int read(char[] buffer,
int off,
int len)
throws java.io.IOException
len chars into buffer starting
at off.read in class java.io.Readerbuffer - the char buffer to be modifiedoff - the offset where to start storing byteslen - the maximum number of bytes to be read (less than length of
b)java.io.IOException - in case of I/O reading errorspublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerjava.io.IOException - in case of I/O errorspublic long skip(long number)
throws java.io.IOException
skip in class java.io.Readernumber - The number of characters to skipjava.lang.IllegalArgumentException - If n is negative.java.io.IOException - If an I/O error occurspublic boolean ready()
throws java.io.IOException
ready in class java.io.Readerjava.io.IOException - If an I/O error occurspublic boolean markSupported()
markSupported in class java.io.Readerpublic void mark(int readAheadLimit)
throws java.io.IOException
mark in class java.io.ReaderreadAheadLimit - Limit on the number of characters that may be
read while still preserving the mark. After
reading this many characters, attempting to
reset the stream may fail.java.io.IOException - If the stream does not support mark(),
or if some other I/O error occurspublic void reset()
throws java.io.IOException
reset in class java.io.Readerjava.io.IOException - If the stream has not been marked,
or if the mark has been invalidated,
or if the stream does not support reset(),
or if some other I/O error occurs