package com.sf._04_字符流;


import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Test1 {
    public static void main(String[] args) throws IOException {
        /**
         * 使用字符输入流读取数据
         */
        FileReader fileReader = new FileReader(new File("D:\\a.txt"));
        int len = -1;
        char[] buffer = new char[10];

        while ((len = fileReader.read(buffer))!=-1){
            System.out.println(len);
            System.out.println(new String(buffer,0,len));
        }
        fileReader.close();
    }
}
