android按行读取文件内容的几个方法

2019-12-10 20:01:58刘景俊

                        String line;
                        //分行读取
                        while (( line = buffreader.readLine()) != null) {
                            content += line + "n";
                        }                
                        instream.close();
                    }
                }
                catch (java.io.FileNotFoundException e) 
                {
                    Log.d("TestFile", "The File doesn't not exist.");
                } 
                catch (IOException e) 
                {
                     Log.d("TestFile", e.getMessage());
                }
            }
            return content;
    }

 

三、用于长时间使用的apk,并且有规律性的数据

1,逐行读取文件内容

复制代码
//首先定义一个数据类型,用于保存读取文件的内容 
class WeightRecord {
        String timestamp;