package com.machuang.convertStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; im... ...
package com.machuang.convertStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Demo01 { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( // a.txt 以utf-8編碼集保存字元 new File("F:/win10/test/a.txt") ), "UTF-8" ) ); String str = null; while(null != (str = reader.readLine())) { System.out.println(str); } reader.close(); } }