该类无引入包
继承自Reader 类
类头注释如下:
/** * Abstract class for reading filtered character streams. * The abstract class <code>FilterReader</code> itself * provides default methods that pass all requests to * the contained stream. Subclasses of <code>FilterReader</code> * should override some of these methods and may also provide * additional methods and fields. * * @author Mark Reinhold * @since JDK1.1 */
大意如下:
该类是个用于过滤读取字符流的抽象类
FilterReader提供了默认的方法将请求传递到其包含的底层流中
以该类作为基类的类需要覆写该类的一些方法,同时也可以提供一些额外的方法和参数
该类含有的成员变量如下:
字符输入流Reader
protected Reader in;
该类含有如下的成员方法:
构造函数(绑定输入流
protected FilterReader(Reader in) { super(in); this.in = in; }
读取一个字符
public int read() throws IOException { return in.read(); }
将字符读入传入数组中(特定位置和长度,返回实际读取数
public int read(char cbuf[], int off, int len) throws IOException { return in.read(cbuf, off, len); }
跳过数个字符(返回跳过字符数
public long skip(long n) throws IOException { return in.skip(n); }
判断输入流是否可读取
public boolean ready() throws IOException { return in.ready(); }
判断该流是否支持标记操作
public boolean markSupported() { return in.markSupported(); }
在当前位置设立标记(传入的是最大回滚距离
public void mark(int readAheadLimit) throws IOException { in.mark(readAheadLimit); }
回滚
public void reset() throws IOException { in.reset(); }
关闭当前流
public void close() throws IOException { in.close(); }
该类作为抽象类十分简单,功能也是简单调用了Reader类,大体结构和BufferedReader差不多,可以参考下