读取文件代码

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();
        }

读取文件内容

原文地址:https://www.cnblogs.com/mac-13/p/11793132.html