home *** CD-ROM | disk | FTP | other *** search
- /**
- Print the contents of filename, url, or stream (like Unix cat)
- */
-
- bsh.help.cat = "usage: cat( filename )";
-
- /**
- cat comment
- */
- cat( String filename )
- {
- file = pathToFile( filename );
-
- if ( !file.exists() || !file.canRead() ) {
- print( "Can't read " + file );
- return;
- }
-
- cat ( new FileReader( file ) );
- }
-
- /**
- cat comment
- */
- cat( URL url )
- {
- cat( url.openStream() );
- }
-
- cat( InputStream ins )
- {
- bin = new BufferedReader( new InputStreamReader( ins ) );
- cat( bin );
- }
-
- cat( Reader reader )
- {
- try {
- bin = new BufferedReader( reader );
- while ( (line=bin.readLine() ) != null )
- print( line );
- } catch ( Exception e ) {
- print( "Error reading stream:"+ e);
- }
- }
-