java——文件读取内容方法

时间:2021-09-17 13:13:12   收藏:0   阅读:38
public static String fileReader(File file) throws IOException {

        String contants;
        FileReader fr =new FileReader(file);
        BufferedReader br =new BufferedReader(fr);
        //
        contants=br.readLine();
        while (br.ready()){
            contants=contants+br.readLine();
        }
        fr.close();
        br.close();
        return contants;
    }

原文:https://www.cnblogs.com/yuxiannana/p/15303107.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!