アットウィキロゴ

jh

package cop;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
 
public class pro {
 
 
    public static void main(String[] args) {
        pro tes=new pro();
    }
 
 
    pro(){
 
        File f1=new File("data.txt");
         File f2=new File("data.txt");
 
 
        try {
 
            copy("data.txt", "data3.txt");
 
        } catch (IOException e) {e.printStackTrace();}
 
 
 
    }
 
public static void copy(String srcPath, String destPath) 
    throws IOException {
 
    FileChannel srcChannel = new FileInputStream(srcPath).getChannel();
    FileChannel destChannel = new FileOutputStream(destPath).getChannel();
    try {
        srcChannel.transferTo(0, srcChannel.size(), destChannel);
    } finally {
        srcChannel.close();
        destChannel.close();
    }
 
}
 
 
}
 
最終更新:2015年03月31日 00:03