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这个缓冲输出流。
通常,此方法将给定数组中的字节存储到该流的缓冲区中,并根据需要将缓冲区刷新到底层输出流中。如果所请求的长度至少和该流的缓冲区一样大,那么这种方法将刷新缓冲区,并将字节直接写入到底层输出流中。因此BufferedOutputStreams不会复制不必要的数据冗余。
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.