/*
 * FileInputOutputStream.java
 *
 * Created on October 2, 2007, 6:03 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
import java.io.*;
/**
 *
 * @author Admin
 */
public class FileInputOutputStream {
   
    /** Creates a new instance of FileInputOutputStream */
    public FileInputOutputStream() {
    }
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        File inputFile = new File("farrago.txt");
        File outputFile = new File("outagain.txt");
       
        FileInputStream in = new FileInputStream(inputFile);
        FileOutputStream out = new FileOutputStream(outputFile);
        int c;
       
        while ((c = in.read()) != -1){
            System.out.println(c);
            out.write(c);
                    }
       
        System.out.println("FileInputStream is used to read a file and FileOutPutStream is used for writing.");
       
        in.close();
        out.close();

    }
   
}