アットウィキロゴ

ふぃぇ99

package file;
 
import java.io.File;
import java.nio.channels.FileChannel;
import java.io.*;
 
public class pro {
 
 
    public static void main(String[] args) {
  pro r=new pro();
    }
 
    pro(){
 
        try {
        copy("a.txt","c.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();
    }
 
}
 
 
    }    
 
最終更新:2016年06月13日 22:36