import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyFile {
public static void main(String args[]) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("D:/Java/MyJava/src/input.txt");
out = new FileOutputStream("D:/Java/MyJava/src/output.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyFile {
public static void main(String args[]) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("D:/Java/MyJava/src/input.txt");
out = new FileOutputStream("D:/Java/MyJava/src/output.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
-----------------------------------------------------------------------------------------------
import java.io.*;
public class CopyFile{
public static void main(String args[])throws IOException {
FileReader in =null;
FileWriter out =null;
try{
in = new FileReader("D:/Java/MyJava/input.txt");
out = new FileWriter("D:/Java/MyJava/output.txt");
int c;
while((c= in.read())!=-1)
{
out.write(c);
}
}
finally{
if(in!=null)
{
in.close();
}
if(out!=null)
{
out.close();
}
}
}
}
public class CopyFile{
public static void main(String args[])throws IOException {
FileReader in =null;
FileWriter out =null;
try{
in = new FileReader("D:/Java/MyJava/input.txt");
out = new FileWriter("D:/Java/MyJava/output.txt");
int c;
while((c= in.read())!=-1)
{
out.write(c);
}
}
finally{
if(in!=null)
{
in.close();
}
if(out!=null)
{
out.close();
}
}
}
}
--------------------------------------------------------------------------------------------------
No comments:
Post a Comment