1 /* 2 * File: Concatenate.java 3 * 4 * An example of SequenceInputStream, similar to UNIX 'cat' 5 * 6 * Taken from Sun's online textbook "The Java Tutorial" 7 * at URL http://java.sun.com/tutorial/index.html 8 * 9 */ 10 11 import java.io.SequenceInputStream; 12 import java.io.IOException; 13 14 class Concatenate { 15 16 public static void main( String[] args ) { 17 18 // An Enumeration object: 19 FileListEnumerator fileList = new FileListEnumerator( args ); 20 21 try { 22 SequenceInputStream in = new SequenceInputStream( fileList ); 23 int c; 24 while ( ( c = in.read() ) != -1 ) { 25 System.out.write( c ); 26 } 27 in.close(); 28 } catch ( IOException e ) { 29 System.err.println( "Concatenate: " + e ); 30 } 31 32 } 33 34 } // end class Concatenate 35