public class RegexReader extends Reader
Constructor and Description |
---|
RegexReader(Regex rex,
Reader r) |
RegexReader(Transformer tex,
Reader r) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the stream.
|
int |
getBufferSize()
Get the size of the working buffer.
|
char |
getEOLchar()
Deprecated.
|
int |
getMaxLines()
Deprecated.
|
boolean |
markSupported()
Returns a boolean that indicates whether the mark/reset
methods are supported in this class.
|
int |
read()
Reads an char from the input stream and returns it
as an int in the range of 0-65535.
|
int |
read(char[] buf,
int off,
int len)
Read chars from a stream and stores them into a caller
supplied buffer.
|
void |
reset()
Resets a stream to the point where the
mark()
method was called. |
void |
setBufferSize(int n)
Set the size of the working buffer.
|
void |
setEOLchar(char c)
Deprecated.
|
void |
setMaxLines(int ml)
Deprecated.
|
long |
skip(long d)
Skips the specified number of chars in the stream.
|
public RegexReader(Transformer tex, Reader r)
public void reset() throws IOException
Reader
mark()
method was called. Any chars that were read after the mark point was
set will be re-read during subsequent reads.
This method always throws an IOException in this class, but subclasses can override this method if they provide mark/reset functionality.
reset
in class Reader
IOException
- Always thrown for this classpublic int read() throws IOException
Reader
This method will block until the char can be read.
read
in class Reader
IOException
- If an error occurspublic int read(char[] buf, int off, int len) throws IOException
Reader
offset
into the buffer and attempts to read len
chars. This method
can return before reading the number of chars requested. The actual
number of chars read is returned as an int. A -1 is returned to indicate
the end of the stream.
This method will block until some data can be read.
This method operates by calling the single char read()
method
in a loop until the desired number of chars are read. The read loop
stops short if the end of the stream is encountered or if an IOException
is encountered on any read operation except the first. If the first
attempt to read a chars fails, the IOException is allowed to propagate
upward. And subsequent IOException is caught and treated identically
to an end of stream condition. Subclasses can (and should if possible)
override this method to provide a more efficient implementation.
read
in class Reader
buf
- The array into which the chars read should be storedoff
- The offset into the array to start storing charsIOException
- If an error occurs.public void close() throws IOException
Reader
IOException
.close
in class Reader
IOException
- If an error occurspublic boolean markSupported()
Reader
This method always returns false
in this class, but
subclasses can override this method to return true
if they
support mark/reset functionality.
markSupported
in class Reader
true
if mark/reset functionality is supported,
false
otherwisepublic int getBufferSize()
public void setBufferSize(int n)
public int getMaxLines()
public void setMaxLines(int ml)
public char getEOLchar()
public void setEOLchar(char c)
public long skip(long d) throws IOException
Reader
This method reads and discards chars into a 256 char array until the specified number of chars were skipped or until either the end of stream is reached or a read attempt returns a short count. Subclasses can override this method to provide a more efficient implementation where one exists.
skip
in class Reader
IOException
- If an error occurs