package aa;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class util {
@SuppressWarnings({ "unused", "resource" })
public static void main(String[] args) {
File file=new File("D:/文件/aaaaaaaaaaaa");
try {
OutputStream out = new FileOutputStream(file+"/1789.mp4");
InputStream in = new FileInputStream("d:文件路径");
BufferedInputStream ib = new BufferedInputStream(in,102400) ;
BufferedOutputStream ob = new BufferedOutputStream(out,102400);
byte[] data = new byte[102400];
long a=System.currentTimeMillis();
System.out.println(a/1000);
while(ib.read(data)!=-1){
ob.write(data);
// ob.write(data,0,data.length);
}
ob.flush();
ob.close();
ib.close();
long b=System.currentTimeMillis();
long c=(b-a)/1000;
System.out.println((double)c);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
i/o流读写大文件数据
最新推荐文章于 2022-10-26 22:30:57 发布