- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- 实现的所有接口
-
Closeable,Flushable,Appendable,AutoCloseable
public abstract class FilterWriter extends Writer
用于编写过滤字符流的抽象类。 抽象类FilterWriter本身提供了将所有请求传递给包含流的默认方法。FilterWriter子类应覆盖其中一些方法,还可能提供其他方法和字段。- 从以下版本开始:
- 1.1
-
-
字段详细信息
-
out
protected Writer out
底层字符输出流。
-
-
构造方法详细信息
-
FilterWriter
protected FilterWriter(Writer out)
创建一个新的筛选编写器。- 参数
-
out- 用于提供基础流的Writer对象。 - 异常
-
NullPointerException- 如果out是null
-
-
方法详细信息
-
write
public void write(int c) throws IOException写一个字符。- 重写:
-
write类Writer - 参数
-
c- 指定要写入的字符的int - 异常
-
IOException- 如果发生I / O错误
-
write
public void write(char[] cbuf, int off, int len) throws IOException写一个字符数组的一部分。- Specified by:
-
write类Writer - 参数
-
cbuf- 要写入的字符缓冲区 -
off- 开始读取字符的偏移量 -
len- 要写入的字符数 - 异常
-
IndexOutOfBoundsException- 如果off和len参数的值导致底层Writer的相应方法抛出IndexOutOfBoundsException -
IOException- 如果发生I / O错误
-
write
public void write(String str, int off, int len) throws IOException
写一个字符串的一部分。- 重写:
-
write类Writer - 参数
-
str- 要写入的字符串 -
off- 开始读取字符的偏移量 -
len- 要写入的字符数 - 异常
-
IndexOutOfBoundsException- 如果off和len参数的值导致底层Writer的相应方法抛出IndexOutOfBoundsException -
IOException- 如果发生I / O错误
-
flush
public void flush() throws IOException刷新流。- Specified by:
-
flush,界面Flushable - Specified by:
-
flush类Writer - 异常
-
IOException- 如果发生I / O错误
-
-