2021-09-05 IO流(字节流的缓冲区)
作者:
Denholm | 来源:发表于
2021-09-22 21:15 被阅读0次import java.io.*;
public class CopyPicBuf {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("E:\\src.png");
BufferedInputStream bis = new BufferedInputStream(fis);
FileOutputStream fos = new FileOutputStream("E:\\copy.png");
BufferedOutputStream bos = new BufferedOutputStream(fos);
// long start = System.currentTimeMillis();
byte[] buf = new byte[1024];
int len;
while ((len = bis.read(buf)) != -1) {
bos.write(buf, 0, len);
}
// long end = System.currentTimeMillis();
// System.out.println("耗时: " + (end - start));
bis.close();
bos.close();
}
}
本文标题:2021-09-05 IO流(字节流的缓冲区)
本文链接:https://www.haomeiwen.com/subject/sbhswltx.html
网友评论