标签:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Copyfile {
long time=System.currentTimeMillis();
public void copy(){
try {
FileInputStream fis =new FileInputStream("a.mp3");
FileOutputStream fos =new FileOutputStream("w.mp3");
byte[] buf = new byte[1024*1000];
int len = 0 ;
while((len=fis.read(buf)) != -1){
fos.write(buf,0,len);
}
fis.close();
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("执行耗时 : "+(System.currentTimeMillis()-time)/1000f+" 秒 ");
}
public static void main(String []args){
Copyfile a= new Copyfile();
a.copy();
}
}
标签:
原文地址:http://www.cnblogs.com/87v5/p/5375072.html