该类无引入包
继承自Writer类
类头注释如下
/** * Abstract class for writing filtered character streams. * The abstract class <code>FilterWriter</code> itself * provides default methods that pass all requests to the * contained stream. Subclasses of <code>FilterWriter</code> * should override some of these methods and may also * provide additional methods and fields. * * @author Mark Reinhold * @since JDK1.1 */
大意如下:
该类是用于写出过滤后字节流的抽象类
该类提供了默认的方法把全部请求传递到包裹的底层流中
以该类作为基类的类需要覆写该类的一些方法并可能需要提供额外的方法和参数
该类含有如下的成员变量:
该类的等层输出流
protected Writer out;
该类含有如下的成员方法:
构造方法(绑定输出流
protected FilterWriter(Writer out) { super(out); this.out = out; }
写出单个字符
public void write(int c) throws IOException { out.write(c); }
写出该数组内特定位置和长度的字符
public void write(char cbuf[], int off, int len) throws IOException { out.write(cbuf, off, len); }
写出字符串中特定位置和长度的字符
public void write(String str, int off, int len) throws IOException { out.write(str, off, len); }
刷新输出流(将流内的数据排出
public void flush() throws IOException { out.flush(); }
关闭输出流
public void close() throws IOException { out.close(); }
该类同FilterReader类一样,也是抽象类,仅做了一些简单的覆写,如果想看这些函数具体运作方式可以看看BufferedWriter类