Java输入输出之字节流拷贝文件

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class JavaIO {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream(
"E:\\Download\\struts-2.3.1.2-all.zip");
FileOutputStream fos = new FileOutputStream("E:\\a.zip");
byte[] b = new byte[1024000];
int n;
while ((n = fis.read(b)) != -1) {
fos.write(b, 0, n);
}
fis.close();
fos.close();
}
}

posted on 2016-02-19 21:04  1130136248  阅读(86)  评论(0)    收藏  举报

导航