/*
    Example based on Sun Java I/O tutorial for File Streams
    
    Reads in a file and copies it out to another file.
 */


import java.io.*;

public class CopyBytes {
    public static void main(String[] args) throws IOException {
        // create two file references
        File inputFile = new File("jung.txt");
        File outputFile = new File("jungout.txt");

        // create to File Streams
        FileInputStream in = new FileInputStream(inputFile);
        FileOutputStream out = new FileOutputStream(outputFile);
        
        // read in one file and write it out to the second
        int c;

        while ((c = in.read()) != -1)
           out.write(c);

        // close both files
        in.close();
        out.close();
    }
}
