Two issues in Files
Alan Bateman
Alan.Bateman at oracle.com
Thu Sep 12 07:17:28 PDT 2013
On 12/09/2013 14:54, Colin Decker wrote:
> :
>
> Thanks. Since SeekableByteChannel has the size() method, it shouldn't
> even be necessary to check if it's a FileChannel I think.
You're right, I've forgotten that it defines size.
>
> As I see it, if something like that is needed, it seems like the
> OutputStream implementation should be doing the slicing. Giving the
> whole array to the OutputStream gives it the best opportunity to do
> what works best for the implementation.
Maybe but it brings up again the issue that OutputStream.write may fail
after having successfully written some bytes. That's not a concern for
Files.write of course as it covers this case but this may require
re-visiting the OutputStream spec and of course implementation changes
to consume less resources when writing big arrays.
-Alan.
More information about the nio-dev
mailing list