RFR: 8017513: Support for closeable streams
Paul Sandoz
paul.sandoz at oracle.com
Thu Aug 29 10:04:56 UTC 2013
On Aug 29, 2013, at 11:15 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 29/08/2013 09:51, Paul Sandoz wrote:
>> On Aug 29, 2013, at 8:58 AM, Alan Bateman<Alan.Bateman at oracle.com> wrote:
>>
>>> :
>>>
>>> I think I mentioned this previously but in the Files.list/walk/etc. methods where you close the resource (on error|runtimeexception) then it's probably best to catch the IOException and add it as a suppressed exception.
>>>
>> Can TWR be used?
>>
>> try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir) {
>> ...
>> }
>>
> It should be only closed for the error/exception case (as the Stream will keep the directory open).
>
Doh, i need some coffee...
Paul.
> Henry - Paul's comment reminds of that "one or more" doesn't need to the javadoc for Files.lines as it only opens one directory.
>
> -Alan.
More information about the core-libs-dev
mailing list