public abstract class FilterReader extends Reader
Reader
and simply redirects calls made to it to the subordinate Reader
instead. Subclasses of this class perform additional filtering
functions in addition to simply redirecting the call.
When creating a subclass of FilterReader, override the
appropriate methods to implement the desired filtering. However, note
that the read(char[]) method does not need to be overridden
as this class redirects calls to that method to
read(yte[], int, int) instead of to the subordinate
Reader} read(yte[]) method.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This method closes the stream by calling the
close() method
of the underlying stream. |
void |
mark(int readlimit)
Calls the
in.mark(int) method. |
boolean |
markSupported()
Calls the
in.markSupported() method. |
int |
read()
Calls the
in.read() method |
int |
read(char[] buf,
int offset,
int len)
Calls the
in.read(char[], int, int) method. |
boolean |
ready()
Calls the
in.read() method. |
void |
reset()
Calls the
in.reset() method. |
long |
skip(long num_chars)
Calls the
in.skip(long) method |
public void close()
throws IOException
close() method
of the underlying stream.close in interface Closeableclose in class ReaderIOException - If an error occurspublic void mark(int readlimit)
throws IOException
in.mark(int) method.mark in class Readerreadlimit - The parameter passed to in.mark(int)IOException - If an error occurspublic boolean markSupported()
in.markSupported() method.markSupported in class Readertrue if mark/reset is supported,
false otherwisepublic int read()
throws IOException
in.read() methodread in class Readerin.read()IOException - If an error occurspublic int read(char[] buf,
int offset,
int len)
throws IOException
in.read(char[], int, int) method.read in class Readerbuf - The buffer to read chars intooffset - The index into the buffer to start storing charslen - The maximum number of chars to read.in.read(char[], int, int)IOException - If an error occurspublic boolean ready()
throws IOException
in.read() method.ready in class Readerin.available()IOException - If an error occurspublic void reset()
throws IOException
in.reset() method.reset in class ReaderIOException - If an error occurspublic long skip(long num_chars)
throws IOException
in.skip(long) methodskip in class Readernum_chars - The requested number of chars to skip.in.skip(long)IOException - If an error occurs