FileCopy
import java.io.*;
public class FileCopy
{
public static void main(String args[])
{
try
{
FileInputStream f1 = null;
FileOutputStream f2 = null;
f1 = new FileInputStream("/home/csa301/Desktop/input.txt");
f2 = new FileOutputStream("/home/csa301/Desktop/output.txt");
int i;
while( (i=f1.read())!=-1)
{
f2.write(i);
}
f1.close();
f2.close();
}
catch(FileNotFoundException e)
{
System.out.println(e);
}
catch(IOException e)
{
System.out.println(e);
}
}
}
Comments
Post a Comment