FileDocCategorySizeDatePackage
ListIt.javaAPI DocExample656Fri Jun 07 03:00:20 BST 1996None

ListIt

public class ListIt extends Object

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

		File file =  new File( args[0] );

		if ( !file.exists() || !file.canRead() ) {
			System.out.println( "Can't read " + file );
			return;
		}

		if ( file.isDirectory() ) {
			String [] files = file.list();
			for (int i=0; i< files.length; i++)
				System.out.println( files[i] );
		}
		else
			try {
				FileInputStream fis = new FileInputStream ( file );
				byte [] data = new byte [ fis.available() ];
				fis.read( data );
				System.out.write( data );
			} catch ( FileNotFoundException e ) {
				System.out.println( "File Disappeared" );
			}