public class FilterOutputStream
extends OutputStream
| java.lang.Object | ||
| java.io.OutputStream | ||
| java.io.FilterOutputStream | ||
| |
| |
这个类是过滤输出流的所有类的超类。 这些流位于已经存在的输出流( 底层输出流)之上,它用作数据的基本接收器,但可能会沿途转换数据或提供附加功能。
类FilterOutputStream本身只是简单地重写的所有方法OutputStream与传递到底层输出流的所有请求的版本。 FilterOutputStream子类可能会进一步重写其中一些方法,并提供其他方法和字段。
Fields |
|
|---|---|
protected OutputStream |
out 要过滤的基础输出流。 |
Public constructors |
|
|---|---|
FilterOutputStream(OutputStream out) 创建一个构建在指定的基础输出流之上的输出流过滤器。 |
|
公共方法(Public methods) |
|
|---|---|
void |
close() 关闭此输出流并释放与该流关联的所有系统资源。 |
void |
flush() 刷新此输出流并强制将任何缓冲的输出字节写出到流中。 |
void |
write(byte[] b) 将 |
void |
write(byte[] b, int off, int len) 将指定的 |
void |
write(int b) 将指定的 |
继承方法(Inherited methods) |
|
|---|---|
java.io.OutputStream
|
|
java.lang.Object
|
|
java.io.Closeable
|
|
java.io.Flushable
|
|
java.lang.AutoCloseable
|
|
FilterOutputStream (OutputStream out)
创建一个构建在指定的基础输出流之上的输出流过滤器。
| 参数(Parameters) | |
|---|---|
out |
OutputStream: the underlying output stream to be assigned to the field this.out for later use, or null if this instance is to be created without an underlying stream. |
void close ()
关闭此输出流并释放与该流关联的所有系统资源。
close方法 FilterOutputStream调用其 flush方法,然后调用其基础输出流的 close方法。
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error occurs. |
void flush ()
刷新此输出流并强制将任何缓冲的输出字节写出到流中。
flush方法 FilterOutputStream调用其基础输出流的 flush方法。
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error occurs. |
也可以看看:
void write (byte[] b)
将 b.length字节写入此输出流。
该 write的方法 FilterOutputStream调用它 write的三个参数方法与参数 b , 0 ,并 b.length 。
注意,此方法不调用一个参数 write其底层流的方法,使用单个参数 b 。
| 参数(Parameters) | |
|---|---|
b |
byte: the data to be written. |
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error occurs. |
也可以看看:
void write (byte[] b,
int off,
int len)
将从指定的 byte数组开始的 len个字节写入此输出流,偏移量为 off 。
该 write的方法 FilterOutputStream调用 write一个参数的每个方法 byte输出。
请注意,此方法不会使用相同的参数调用其基础输入流的write方法。 FilterOutputStream子类应提供此方法的更高效的实现。
| 参数(Parameters) | |
|---|---|
b |
byte: the data. |
off |
int: the start offset in the data. |
len |
int: the number of bytes to write. |
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error occurs. |
也可以看看:
void write (int b)
将指定的 byte写入此输出流。
该 write的方法 FilterOutputStream调用 write其基础输出流的方法,也就是说,它执行 out.write(b)。
实现的 OutputStream抽象 write方法。
| 参数(Parameters) | |
|---|---|
b |
int: the byte. |
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error occurs. |