Описание тега bufferedoutputstream
An BufferedOutputStream
is a wrapper around an OutputStream
, whereby the data being written is buffered locally before being written to the stream. Buffering can be either fully-buffered or partially-buffered. Fully-buffered is where the entire contents are written to a local buffer before it is sent over the OutputStream
. Partially-buffered is where a small portion of the data is held in a local buffer, and once the buffer is full, that data is written to the stream and the buffer is emptied.
An OutputStream
is usually buffered to improve performance, as it allows data to be written to a network of file in large efficient chunks, rather than a number of smaller writes. This removes the overhead and performance impact of the multiple small writes. The downside, however, is that the buffer consumes some memory and has some CPU impact, but these downsides are usually very tiny, and are far outweighed by the benefits of buffering.