模拟javaweb项目中的相似报错

BufferedInputStream bis = new BufferedInputStream(new FileInputStream("shabi.mp3"));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("qiucao.mp3"));
int b;
while((b=bis.read())!= -1){
bos.write(b);
bos.close();
}

Exception in thread "main" java.io.IOException: Stream Closed
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:345)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:95)
at com.leaderfar.stream.Demo4_arrayCopy.main(Demo4_arrayCopy.java:26)

第一次写完流就已经关掉了 关完之后有想去写  就没法写了 流都已经关掉了 就不能写了

posted @ 2018-01-05 17:04  老鱼SOHO  阅读(178)  评论(0)    收藏  举报