-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
13, 14
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
Currently only Files.lines() returns a stream which closes the underlying BufferedReader when the stream is closed. However, the stream returned by BufferedReader.lines() does not close the reader.
Since the documentation of BufferedReader.lines() even says
"The reader must not be operated on during the execution of the terminal stream operation."
it is most likely that if this method is used, the reader will not be used in any other way, especially since the end of file has been reached once the stream is completely processed (even though lines() is for some reason pretty vague regarding this).
Enhancement request:
Add an `onClose` handler to the returned stream which closes the reader. This would for example allow using the stream directly within a try-with-resources statement.
Currently only Files.lines() returns a stream which closes the underlying BufferedReader when the stream is closed. However, the stream returned by BufferedReader.lines() does not close the reader.
Since the documentation of BufferedReader.lines() even says
"The reader must not be operated on during the execution of the terminal stream operation."
it is most likely that if this method is used, the reader will not be used in any other way, especially since the end of file has been reached once the stream is completely processed (even though lines() is for some reason pretty vague regarding this).
Enhancement request:
Add an `onClose` handler to the returned stream which closes the reader. This would for example allow using the stream directly within a try-with-resources statement.