Java Tutorial

 
 
 
 
import java.io.*;

class  CopyBytes
{
    public static void main(String[] args) 
    {
          FileInputStream fis = null;
          FileOutputStream fos = null;

          try{
               fis = new  FileInputStream(\"input.txt\");
               fos = new FileOutputStream(\"output.txt\");

               int ch;
               while((ch=fis.read())!=1){
                    fos.write(ch);
               }
             }catch(IOException e)
                {
                  System.out.println(e);
                  System.exit(-1);
                }
            finally{
                 try{
                       fos.close();
                       fis.close();
                 }
                 catch(IOException e){}
            }

    }
}

 
 
Didn't find what you were looking for? Find more on File handling program to copy bytes from one file to another