BufferedOutputStream的目的是什么? [英] what's the purpose of BufferedOutputStream?
问题描述
我想知道BufferedOutputStream的用途,使用它时的性能提升?
I am wondering the purpose of BufferedOutputStream, performance gain when using it?
推荐答案
以下是来自 BufferedOutputStream的API :
该类实现缓冲输出流。通过设置这样的输出流,应用程序可以将字节写入基础输出流,而必然会为每个写入的字节调用底层系统。
The class implements a buffered output stream. By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written.
它可以在缓冲区内完成大部分操作,而无需调用底层系统。
It can do most of operations within the buffer, and without a call to the underlying system.
例如,考虑写入文件:没有缓冲区,它必须为每个字节进行系统调用,这显然很慢。
For example, consider writing to file: without buffer, it has to make a system call for every single byte, which is obviously slow.
这篇关于BufferedOutputStream的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!