IO之二

使用字节流对非文本文件进行复制
 //使用字节流对非文本文件进行复制
        int len;
        byte[] bytes = new byte[1024];
        while ((len=inputStream.read())!=-1){
            outputStream.write(bytes,0,len);
        }
使用字符流对非文本文件进行复制
int len1;
        char[] chars = new char[1024];
        while ((len1=inputStream.read())!=-1){
            writer.write(chars,0,len1);
        }

 

posted @ 2021-12-10 11:06  Boerk  阅读(208)  评论(0)    收藏  举报