RFR: 8320971: Use BufferedInputStream.buf directly when param of implTransferTo() is trusted [v3]
Alan Bateman
alanb at openjdk.org
Mon Dec 4 14:01:44 UTC 2023
On Mon, 4 Dec 2023 13:30:02 GMT, Vladimir Sitnikov <vsitnikov at openjdk.org> wrote:
> > it doesn't solve the second part of the concern which is read-only view on the internal buffer.
>
> I think `ByteBuffer.asReadOnlyBuffer()` should resolve the issues regarding naked byte access. At least `ByteBuffer#array()` returns `null` for read-only buffers, and `ByteBuffer#hasArray()` returns `false`. Am I missing something?
The backing array is not frozen so a read-only view doesn't address the second part of the concern where the target keeps a reference.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16879#discussion_r1413912622
More information about the core-libs-dev
mailing list