BufferedOutputStream Class

Package: java.io

The BufferedOutputStream class writes characters to an output stream, using a buffer for increased efficiency.

You won’t typically work directly with the BufferedOutputStream class; instead, you’ll use it to connect to a DataOutputStream, which has more advanced features for writing input data from binary files. As a result, this section shows only the constructor for the BufferedOutputStream class and not its methods. For more information, see DataOutputStream Class.

CrossRef.eps The BufferedOutputStream class is one of many Java I/O classes that use streams. For more information, see Streams (Overview).

Constructor

Constructor

Description

BufferedIOutputStream (OutputStream out)

Creates a buffered output stream for the specified stream. Typically, you pass this constructor a FileOutput Stream object.

The following example shows how to create a Buffered OutputStream object that connects to a binary file:

File f;

FileOutputStream fstream;

BufferedOutputStream bstream;

f = new File(“myfile.bin”);

fstream = new FileOutputStream(f);

bstream = new BufferedOutputStream(fstream);

Get Java For Dummies Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.