public class FilterOutputStream extends OutputStream
这类FilterOutputStream本身只是重写,通过所有的请求给底层输出流的版本OutputStream所有方法。子FilterOutputStream可能进一步覆盖其中的一些方法以及提供额外的方法和字段。
| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
out
待过滤的底层输出流。
|
| Constructor and Description |
|---|
FilterOutputStream(OutputStream out)
创建一个在指定的基础输出流顶部建立的输出流过滤器。
|
protected OutputStream out
public FilterOutputStream(OutputStream out)
out -底层输出流被分配到外地
this.out供以后使用,或
null如果此实例被创建,没有潜在的流。
public void write(int b)
throws IOException
byte到输出流。
对FilterOutputStream的write方法调用的输出流,这是write方法,它执行out.write(b)。
实现了OutputStream抽象write方法。
write 方法重写,继承类
OutputStream
b -
byte。
IOException如果I/O错误发生。
public void write(byte[] b)
throws IOException
b.length字节输出流。
对FilterOutputStream的write方法调用它的write方法三参数与参数b,0,和b.length。
请注意,此方法不需要对其底层的流的一个参数write方法与单参数b。
write 方法重写,继承类
OutputStream
b -要写入的数据。
IOException如果I/O错误发生。
write(byte[], int, int)
public void write(byte[] b,
int off,
int len)
throws IOException
len字节从指定的
byte数组起始偏移
off到输出流。
对FilterOutputStream的write方法调用每个byte输出一个参数的write方法。
请注意,此方法不需要对其底层的输入流的write方法具有相同的参数。子FilterOutputStream应该提供一个更有效的方法实现。
write 方法重写,继承类
OutputStream
b -数据。
off -在数据的起始偏移量。
len -字节数写。
IOException如果I/O错误发生。
write(int)
public void flush()
throws IOException
对FilterOutputStream的flush方法调用的底层输出流的flush方法。
flush 接口
Flushable
flush 方法重写,继承类
OutputStream
IOException如果I/O错误发生。
out
public void close()
throws IOException
对FilterOutputStream的close方法调用它的flush方法,然后调用其底层输出流的close方法。
close 接口
Closeable
close 接口
AutoCloseable
close 方法重写,继承类
OutputStream
IOException如果I/O错误发生。
flush(),
out
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.