admin管理员组文章数量:1516870
package cn.mldn.demo;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
public class CopyDemo {
public static void main(String[] args)throws Exception{
long start=System.currentTimeMillis();
if(args.length!=2){
System.out.println(“参数输入不正确”);
System.exit(1);
}
File infile=new File(args[0]);
if(!infile.exists()){//源文件不存在要加!
System.out.println(“未到源文件”);
System.exit(1);
}
File outfile=new File(args[1]);
if(!outfile.getParentFile().exists()){
System.out.println(“不存在此目录,但己自动创建”);
outfile.mkdir();
}
InputStream input=new FileInputStream(infile);
OutputStream output=new FileOutputStream(outfile);
int temp=0;//保存每次读取的次数
byte date[]=new byte[1024];//每次循环所存的数据最大为1024字节
while((temp=input.read(date))!=-1){//每次循环所读取的数据都存到数组中(缓冲区)
output.write(date,0,temp);//输出数组中的数据至指定文件,从每次循环开始,由数组起始位置到读取位置
}
input.close();
output.close();
long end=System.currentTimeMillis();
System.out.println((start-end)/60.0000/60.0000+”秒”);
}
}
版权声明:本文标题:破解Flash中心转场之谜:一份实用的文件复制秘籍 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.betaflare.com/biancheng/1770554970a3255926.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论