/* * File: Concatenate.java * * An example of SequenceInputStream, similar to UNIX 'cat' * * Taken from Sun's online textbook "The Java Tutorial" * at URL http://java.sun.com/tutorial/index.html * */ import java.io.SequenceInputStream; import java.io.IOException; class Concatenate { public static void main( String[] args ) { // An Enumeration object: FileListEnumerator fileList = new FileListEnumerator( args ); try { SequenceInputStream in = new SequenceInputStream( fileList ); int c; while ( ( c = in.read() ) != -1 ) { System.out.write( c ); } in.close(); } catch ( IOException e ) { System.err.println( "Concatenate: " + e ); } } } // end class Concatenate