第四周JAVA作业
本次作業實現實現了大文件快速拷貝
package copy;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyFile {
/**
* @param args
*/
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
try {
FileInputStream fis = new FileInputStream ("a.mp3");
FileOutputStream fos = new FileOutputStream ("temp.mp3");
int read = fis.read();
byte[] b = new byte[1024*1000];
int len = 0 ;
while((len=fis.read(b)) != -1){
fos.write(b,0,len);
}
fis.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
轉載于:https://www.cnblogs.com/lijie12/p/5369856.html
總結
- 上一篇: mysql 授权远程连接_MySQL远程
- 下一篇: 从完美KL距离推导VAE