【字符输入流: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(); } }
终身学习者

浙公网安备 33010602011771号