import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.*;
import java.io.*;
public class FileCopy
{
public static void main(String[] args)
{
args[0] = "e://mytest.txt";
args[1] = "e://temp.txt";
FileReader fileRead = null;
BufferedReader bufRead = null;
FileWriter fileWriter = null;
BufferedWriter bufWriter = null;
try
{
fileRead = new FileReader(args[0]);
bufRead = new BufferedReader(fileRead);
fileWriter = new FileWriter(args[1],true);
bufWriter = new BufferedWriter(fileWriter);
String count = null;
while((count = bufRead.readLine())!=null)
{
bufWriter.write(count);
}
bufWriter.flush();
}
catch (FileNotFoundException ex)
{
System.out.println(ex.toString());
}
catch (IOException ex)
{
System.out.println(ex.toString());
}
finally
{
try
{
bufWriter.close();
fileWriter.close();
bufRead.close();
fileRead.close();
}
catch (IOException ex1)
{
System.out.println(ex1.toString());
}
}
}
}