java.io

Class FilterReader

public abstract class FilterReader extends Reader

This is the common superclass of all standard classes that filter input. It acts as a layer on top of an underlying 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.

Field Summary
protected Readerin
This is the subordinate Reader to which method calls are redirected
Constructor Summary
protected FilterReader(Reader in)
Create a FilterReader with the specified subordinate Reader.
Method Summary
voidclose()
This method closes the stream by calling the close() method of the underlying stream.
voidmark(int readlimit)
Calls the in.mark(int) method.
booleanmarkSupported()
Calls the in.markSupported() method.
intread()
Calls the in.read() method
intread(char[] buf, int offset, int len)
Calls the in.read(char[], int, int) method.
booleanready()
Calls the in.read() method.
voidreset()
Calls the in.reset() method.
longskip(long num_chars)
Calls the in.skip(long) method

Field Detail

in

protected Reader in
This is the subordinate Reader to which method calls are redirected

Constructor Detail

FilterReader

protected FilterReader(Reader in)
Create a FilterReader with the specified subordinate Reader. The lock of the new FilterReader will be set to in.lock.

Parameters: in The subordinate Reader

Method Detail

close

public void close()
This method closes the stream by calling the close() method of the underlying stream.

Throws: IOException If an error occurs

mark

public void mark(int readlimit)
Calls the in.mark(int) method.

Parameters: readlimit The parameter passed to in.mark(int)

Throws: IOException If an error occurs

markSupported

public boolean markSupported()
Calls the in.markSupported() method.

Returns: true if mark/reset is supported, false otherwise

read

public int read()
Calls the in.read() method

Returns: The value returned from in.read()

Throws: IOException If an error occurs

read

public int read(char[] buf, int offset, int len)
Calls the in.read(char[], int, int) method.

Parameters: buf The buffer to read chars into offset The index into the buffer to start storing chars len The maximum number of chars to read.

Returns: The value retured from in.read(char[], int, int)

Throws: IOException If an error occurs

ready

public boolean ready()
Calls the in.read() method.

Returns: The value returned from in.available()

Throws: IOException If an error occurs

reset

public void reset()
Calls the in.reset() method.

Throws: IOException If an error occurs

skip

public long skip(long num_chars)
Calls the in.skip(long) method

Parameters: num_chars The requested number of chars to skip.

Returns: The value returned from in.skip(long)

Throws: IOException If an error occurs