packagech12;importjava.io.*;publicclassCh12_1{publicstaticvoidmain(String[]args){BufferedInputStreamb1=null;BufferedOutputStreamb2=null;try{b1=newBufferedInputStream(newF...
package ch12;
import java.io.*;
public class Ch12_1 {
public static void main(String[] args) {
BufferedInputStream b1 = null;
BufferedOutputStream b2 = null;
try{
b1 = new BufferedInputStream(new FileInputStream("c:\\num1.wma"));
b2 = new BufferedOutputStream(new FileOutputStream("D:\\num1.wma"));
int i=b1.read();
while(i!=-1){
b2.write((char)i);
}
b2.flush();
}catch(IOException e){
e.printStackTrace();
}finally{
try{
if(null != b2 ){
b2.close();
}
}catch(IOException e){
e.printStackTrace();
}try{
if(null != b1){
b1.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
}
}
这个是我写的一个复制文件的 有这样错误 开始复制以后就会把原文件的内容不停地复制到目标文件 必须手动关闭 我已经加了finally和 close方法 还是关不了 求解 谢谢
展开