public static void main(String[] args)throws IOException { List<Integer> list=new ArrayList<>(); DecimalFormat df=new DecimalFormat("######0.00"); FileInputStream fip = new FileInputStream("D:\StudyWay\Harry Potter and the Sorcerer's Stone.txt"); InputStreamReader reader = new InputStreamReader(fip, "gbk"); StringBuffer sb = new StringBuffer(); while (reader.ready()) { sb.append((char) reader.read()); } reader.close(); fip.close(); }
读取文件内容