所有类
java.io
类 FilterWriter
java.lang.Object
java.io.Writer
java.io.FilterWriter
- 所有已实现的接口:
- Closeable, Flushable, Appendable
public abstract class FilterWriter
- extends Writer
用于写入已过滤的字符流的抽象类。抽象类 FilterWriter
自身提供了一些将所有请求传递给所包含的流的默认方法。FilterWriter
的子类应重写这些方法中的一些方法,并且还可以提供一些额外的方法和字段。
- 从以下版本开始:
- JDK1.1
方法摘要 |
---|
void | close() 关闭该流。 |
void | flush() 刷新该流的缓冲。 |
void | write(char[] cbuf, int off, int len) 将字符写入数组的某一部分。 |
void | write(int c) 写入单个字符。 |
void | write(String str, int off, int len) 写入一部分字符串。 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
protected Writer out
- 基础字符输出流。
FilterWriter
protected FilterWriter(Writer out)
- 创建一个新的 filtered writer。
- 参数:
out
- 提供基础流的 Writer 对象。 - 抛出:
NullPointerException
- 如果 out
为 null
write
public void write(int c)
throws IOException
- 写入单个字符。
- 覆盖:
- 类
Writer
中的 write
- 参数:
c
- 指定要写入字符的 int。 - 抛出:
IOException
- 如果发生 I/O 错误
write
public void write(char[] cbuf,
int off,
int len)
throws IOException
- 将字符写入数组的某一部分。
- 指定者:
- 类
Writer
中的 write
- 参数:
cbuf
- 待写入的字符缓冲区 off
- 偏移量,从该处开始读取字符 len
- 待写入字符的数量 - 抛出:
IOException
- 如果发生 I/O 错误
write
public void write(String str,
int off,
int len)
throws IOException
- 写入一部分字符串。
- 覆盖:
- 类
Writer
中的 write
- 参数:
str
- 待写入的字符串 off
- 偏移量,从该处开始读取字符 len
- 待写入字符的数量 - 抛出:
IOException
- 如果发生 I/O 错误
flush
public void flush()
throws IOException
- 刷新该流的缓冲。
- 指定者:
- 接口
Flushable
中的 flush
- 指定者:
- 类
Writer
中的 flush
- 抛出:
IOException
- 如果发生 I/O 错误
close
public void close()
throws IOException
- 关闭该流。
- 指定者:
- 接口
Closeable
中的 close
- 指定者:
- 类
Writer
中的 close
- 抛出:
IOException
- 如果发生 I/O 错误
所有类