Flushing Output Streams

Sometimes output streams are buffered by the operating system for performance. In other words, rather than writing each byte as it's written the bytes are accumulated in a buffer ranging from several bytes to several thousand bytes. Then, when the buffer fills up, all the data is written at once. The flush() method forces the data to be written whether or not the buffer is full.

This is not the same as the buffering performed by a BufferedOutputStream. That buffering is handled by the Java runtime. This buffering is at the native OS level. However, a call to flush() should empty both buffers

Previous | Next | Top | Cafe con Leche

Copyright 2000 Elliotte Rusty Harold
Last Modified January 28, 2000