先了解jdk1.6及之前版本IO流异常处理标准代码
jdk1.7 IO流异常处理标准代码
public void demo()
throws FileNotFoundException, IOException {
try(
FileInputStream fis =
new FileInputStream(
"a.txt");
FileOutputStream fos =
new FileOutputStream(
"b.txt");
){
byte[] arr =
new byte[
1024*
8];
int len;
while((len = fis.read(arr)) != -
1) {
fos.write(arr,
0,len);
}
}
}
转载请注明原文地址: https://ju.6miu.com/read-950340.html