public class BufferedOutputStream extends FilterOutputStream
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buf
存储数据的内部缓冲区。
|
protected int |
count
缓冲区中有效字节数。
|
out
Constructor and Description |
---|
BufferedOutputStream(OutputStream out)
创建一个新的缓冲输出流,将数据写入到指定的基本输出流中。
|
BufferedOutputStream(OutputStream out, int size)
创建一个新的缓冲输出流,用指定的缓冲区大小写数据到指定的基本输出流中。
|
protected byte[] buf
protected int count
public BufferedOutputStream(OutputStream out)
out
-底层输出流。
public BufferedOutputStream(OutputStream out, int size)
out
-底层输出流。
size
-缓冲区大小。
IllegalArgumentException
如果尺寸≤0。
public void write(int b) throws IOException
write
方法重写,继承类
FilterOutputStream
b
的字节被写入。
IOException
如果I/O错误发生。
public void write(byte[] b, int off, int len) throws IOException
len
字节指定字节数组中的起始偏移
off
这个缓冲输出流。
通常,此方法将给定数组中的字节存储到该流的缓冲区中,并根据需要将缓冲区刷新到底层输出流中。如果所请求的长度至少和该流的缓冲区一样大,那么这种方法将刷新缓冲区,并将字节直接写入到底层输出流中。因此BufferedOutputStream
s不会复制不必要的数据冗余。
write
方法重写,继承类
FilterOutputStream
b
-数据。
off
的起始偏移量的数据。
len
-字节数写。
IOException
如果I/O错误发生。
FilterOutputStream.write(int)
public void flush() throws IOException
flush
接口
Flushable
flush
方法重写,继承类
FilterOutputStream
IOException
如果I/O错误发生。
FilterOutputStream.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.