home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-12-14 | 816 b | 27 lines |
-
- import java.io.*;
-
- public class BufferedWriteStream
- {
- // This program runs as an application
- public static void main(String[] arguments)
- {
- //Create an array of data to print
- int[] allBytes = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29};
- try
- {
- //declare a stream
- FileOutputStream ofile = new FileOutputStream("bufBytes.dat");
- BufferedOutputStream bufStream = new BufferedOutputStream(ofile);
- for (int i=0; i < allBytes.length; i++)
- //write to the stream
- bufStream.write(allBytes[i]);
- bufStream.close();
- } catch (IOException e)// handle any errors
- {
- System.out.println("Error - " + e.toString());
- }//catch
- }//main
- }//BufferedWriteStream
-
-