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)); } }}
原文地址:https://www.cnblogs.com/newcityboy/p/11259946.html
时间: 2024-10-06 06:51:32