FileDocCategorySizeDatePackage
FormatTester.javaAPI DocExample714Sat Apr 24 08:25:56 BST 2004com.oreilly.tiger.ch09

FormatTester

public class FormatTester extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    String filename = args[0];

    try {
      File file = new File(filename);
      FileReader fileReader = new FileReader(file);
      BufferedReader reader = new BufferedReader(fileReader);
   
      String line;
      int i = 1;
      while ((line = reader.readLine()) != null) {
        System.out.printf("Line %d: %s%n", i++, line);
      }

    } catch (Exception e) {
      System.err.printf("Unable to open file named '%s': %s", 
                        filename, e.getMessage());
    }