home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-12-14 | 724 bĀ | 26 lines |
- import java.io.*;
-
- public class WriteStream
- {
- // This program runs as an application
- public static void main(String[] arguments)
- {
- //Create an array of data to print
- int[] allBytes = {2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
- try
- {
- //declare a stream
- FileOutputStream ofile = new ĻFileOutputStream("bytes.dat");
- for (int i=0; i < allBytes.length; i++)
- //write to the stream
- ofile.write(allBytes[i]);
- ofile.close();
- } catch (IOException e)// handle any errors
- {
- System.out.println("Error - " + e.toString());
- }//catch
- }//main
- }//WriteStream
-
-
-