java.io.FileOutputStream

java.io.FileOutputStream is a class that implements the abstract class java.io.OutputStream.

Hints

If your application is experiencing poor performance, and it uses a FileOutputStream object to write a large amount of data to a file, try using a BufferedOutputStream object instead.

The FileOutputStream class, which inherits from the OutputStream class, writes data one byte at a time. This means that if a file contains one million bytes of data, then a FileOutputStream object must perform at least one million writes before the entire contents of the file is written. In contrast, a BufferedOutputStream object writes data in large blocks and buffers it in memory for faster processing.

If using a BufferedOutputStream object still does not satisfy your performance goals, try implementing your own custom buffered output stream object that uses blocked writes, such as writing 1K of data per write. Also, try experimenting with different sizes of write buffers.

Related Topics:

java.io.BufferedOutputStream

java.io.InputStream

java.io.OutputStream

java.io.FileInputStream

java.io.BufferedInputStream