try( BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream bos = new BufferedOutputStream(fos); ){ int b; while((b=bis.read())!=-1) { bos.write(b); } }
因为inputStream体系实现了AutoCloseable接口是从jdk1.7版本开始的