Я записываю в файл через BufferWriter.
Если я удалю этот файл из файловой системы Windows, пока BufferWriter все еще записывает, программа не сообщает об ошибках.
Куда пишет BufferWriter, если файл больше не существует?
Код: Выделить всё
BufferedWriter bwFileOUTFrag = Files.newBufferedWriter(_fOUTFrag.toPath(), _fIN_CharSet);
bwFileOUTFrag.write("my first line");
bwFileOUTFrag.flush(); // write buffer to file
Thread.sleep(5000L); //while I wait for this to end, I delete the file _fOUTFrag from windows file system
bwFileOUTFrag.write("the file should not exist");
bwFileOUTFrag.flush(); // I expect an error here because the file doesn't exist!!!
bwFileOUTFrag.close();
И, если это ожидаемое поведение, как я могу перехватить это событие?
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/798 ... ts-anymore
Мобильная версия