标签:字符 stream throws str file void put ati imp
一、小文件一次快速读写
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Test11 {
public static void main(String[] args) throws IOException {
//关联文件
Long bigain = System.currentTimeMillis();
File fNew = new File("F:\\BaiduNetdiskDownload\\数据结构与算法\\02_谈谈算法.mp4"); //src文件地址
FileInputStream inFile = new FileInputStream("F:\\BaiduNetdiskDownload\\数据结构与算法\\02_谈谈算法.mp4"); //src文件地址
FileOutputStream outFile = new FileOutputStream("D:\\Desktop\\newFile\\02_谈谈算法.mp4"); //dst文件
//读写文件
byte [] arr = new byte[(int) fNew.length()]; //声明数组
inFile.read(arr); //把inFile缓存到arr数组
outFile.write(arr); //写
//关闭流
inFile.close();
outFile.close();
Long endT = System.currentTimeMillis();
System.out.println(endT-bigain);
}
}
标签:字符 stream throws str file void put ati imp
原文地址:http://www.cnblogs.com/-maji/p/7100266.html