FileDocCategorySizeDatePackage
CatFile.javaAPI DocExample880Sat Nov 25 12:55:26 GMT 2000None

CatFile

public class CatFile extends Object
Read a file and print, using BufferedReader and System.out

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

        CatFile c = new CatFile();
        if (av.length == 0)
            c.process(new BufferedReader(
					new InputStreamReader(System.in)));
		else for (int i=0; i<av.length; i++)
			try {
				c.process(new BufferedReader(new FileReader(av[i])));
			} catch (FileNotFoundException e) {
				System.err.println(e);
			}
    
public voidprocess(java.io.BufferedReader is)
print one file, given an open BufferedReader

        try {
            String inputLine;

            while ((inputLine = is.readLine()) != null) {
                System.out.println(inputLine);
            }
            is.close();
        } catch (IOException e) {
            System.out.println("IOException: " + e);
        }