使用buffered流结合byte数组,读入文件中的内容,包括中文字符

package com.itcast.demo05.Buffered;

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

/**
* @author newcityman
* @date 2019/7/28 - 16:35
* 使用buffered流结合byte数组,读入文件中的内容,包括中文字符
*/
public class BufferedInputStream01 {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("day18_IOAndProperties\\buffer.txt");
BufferedInputStream bis = new BufferedInputStream(fis);
byte[] bytes = new byte[1024];
int len =0;
while ((len=bis.read(bytes))!=-1){
System.out.print(new String(bytes));
}
}
}
posted on 2019-07-28 16:57  小猪_佩奇  阅读(325)  评论(0编辑  收藏  举报