1 |
DataOutputStream and BufferedOutputStream are two important FilterOutputStreams.
|
2 |
To open a data stream to an output file, use:
-
DataOutputStream out =
-
new DataOutputStream (
-
new FileOutputStream( filename ) );
|
3 |
where filename is a filename string.
|
4 |
Note that DataOutputStream has methods to write any primitive type.
-
To open a buffered output stream, use:
-
BufferedOutputStream out =
-
new BufferedOutputStream (
-
new FileOutputStream( filename ) );
|
5 |
Only bytes may be written to a BufferedOutputStream.
|