【字符输入流:InputStreamReader】

package test;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author shusheng
 * @description
 * @Email shusheng@yiji.com
 * @date 2018/11/12 11:00
 */
public class InputStreamReaderDemo1 {

    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(
                new FileInputStream("C:\\Users\\shusheng\\Pictures\\111.txt"));
        char[] chs = new char[1024];
        int len = 0;
        while ((len = isr.read(chs)) != -1) {
            System.out.println(new String(chs, 0, len));
        }
        isr.close();
    }

}

 

posted @ 2018-11-12 15:04  书丶生  阅读(402)  评论(0)    收藏  举报