1 /* 2 * File: TextInputTest.java 3 * 4 * Character stream input with Reader classes 5 * 6 * Copyright: Northeast Parallel Architectures Center 7 * 8 */ 9 10 import java.io.IOException; 11 import java.io.RandomAccessFile; 12 13 public class TextInputTest { 14 15 public static void main( String args[] ) throws IOException { 16 17 String line; // for input 18 19 String filename = "TextIOTest.dat"; 20 21 RandomAccessFile in = new RandomAccessFile( filename, "r" ); 22 23 System.out.println( "Reading..." ); 24 while ( ( line = in.readLine() ) != null ) { 25 System.out.println( line ); 26 } 27 28 in.close(); 29 30 } 31 32 }