While reading from a file by BufferedReader
, if I delete the file by rm -rf
the BufferedReader
terminates without IOException
Asked
Active
Viewed 41 times
1

Ikbal Rasimov
- 45
- 6
1 Answers
2
This is normal, expected behaviour. Deleting a file on Unix-like systems involves removing a link to the file's data location in the directory entry table. When there are no links to the file, and no file descriptors open to it, it's space will be reclaimed. As there is a file descriptor currently open (through your use of BufferedReader), it will remain open until the BufferedReader finishes. Although the file is open, it is not visible in the directory listing.

k314159
- 5,051
- 10
- 32