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