缓冲的读取器在读取FIS时引发FileNotFound异常

时间:2018-12-26 14:21:17

标签: java android fileinputstream

在第一种方法中,我在applicatin目录中创建了一个文件,然后尝试使用BufferedReader读取该文件,但是由于某种原因,该应用程序始终抛出FileNotFound异常,我也不知道为什么。

select
  id, string_agg (doc_id, ',')
from table
group by id
having
  count (*) > 1 or
  min (doc_id) not in ('01', '02')

这是阅读器代码

Writer output = null;
    File file = new File(getApplicationContext().getFilesDir(), "past");
    output = new BufferedWriter(new FileWriter(file, true));
    output.write(format_1 + "Overall positivity was " + sprog);
    output.close();

这是调试抛出的东西

public void past(View v) throws IOException {
    try(BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("past"),StandardCharsets.UTF_8))){

        String line;

        while ((line=br.readLine()) != null){
            System.out.println(line);
        }
    }
}

0 个答案:

没有答案