java字节缓冲流


import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

//字节缓冲流
public class BufferInputStream1 {
    public static void main(String[] args) throws IOException {
        BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream("E:\\Workpace\\abc.txt"));
        byte[] bytes = new byte[1024];
        int len;
        while ((len = inputStream.read(bytes)) != -1){
            System.out.print(new String(bytes,0,len));
        }
        inputStream.close();
    }
}


posted @ 2021-05-01 10:15  code-G  阅读(52)  评论(0编辑  收藏  举报