int read(char[] cbuf, int off, int len)方法,每次读取len个字符放到字符数组cbuf中,从数组cbuf的下表off开始放,返回的是每次读取的字符个数。

    1. public static void printByFileReaderChars(String filePath) throws IOException
    2. {
    3. BufferedReader reader=new BufferedReader(
    4. new FileReader(filePath)
    5. );
    6. if(!reader.ready())
    7. {
    8. System.out.println("文件流暂时无法读取");
    9. return;
    10. }
    11. int size=0;
    12. char[] cbuf=new char[20];
    13. while((size=reader.read(cbuf, 0, cbuf.length))!=-1)
    14. {
    15. System.out.print(new String(cbuf,0,size));
    16. }
    17. reader.close();
    18. }