8014928: (fs) Files.readAllBytes() copies content to new array when content completely read
Martin Buchholz
martinrb at google.com
Tue May 28 20:27:32 PDT 2013
Looks good!
On Sat, May 25, 2013 at 4:23 AM, Alan Bateman <Alan.Bateman at oracle.com>wrote:
> On 24/05/2013 19:40, Martin Buchholz wrote:
>
>> Looks good.
>>
>> ObMartin:
>>
>> s/Read/Reads/
>>
>> Array creations of size MAX_VALUE - 8 are much more likely to succeed
>> than MAX_VALUE
>>
>> For byte[] then it's more like MAX_VALUE-2 but it might be better if we
> just remove this because it's never used. Originally this private read
> method was used for something else where the expected size wasn't known so
> this is why it expands the buffer. For the only usage now then we know the
> size in advance and we just need to handle the case that the file is
> truncated or replaced (which in both cases you're on your own).
>
> I've updated the webrev to eliminate this method and just put the simple
> read loop into readAllBytes.
>
> -Alan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20130528/f890c135/attachment.html
More information about the nio-dev
mailing list