home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-12-14 | 1.1 KB | 39 lines |
-
- import java.io.*;
-
- public class BufferedReadDataStream
- {
- // This program runs as an application
- public static void main(String[] arguments)
- {
- try
- {
- //declare a stream
- FileInputStream ifile = new FileInputStream("bufDouble.dat");
- BufferedInputStream bufStream = new BufferedInputStream(ifile);
- DataInputStream datStream = new DataInputStream(bufStream);
- int cntDoubles = 0;
- try
- {
- while (true)
- {
- double thisVal = datStream.readDouble();
- System.out.print( thisVal + " ");
- cntDoubles++;
- } //while
- } catch (EOFException eof)
- {
- datStream.close();
- System.out.print("\nDoubles read: " + [ccc]
- cntDoubles);
- } //catch
-
- } catch (IOException e)// handle any errors
- {
- System.out.println("Error - " + e.toString());
- }//catch
- }//main
- }//BufferedReadDataStream
-
-
-