RFC: 5029431: (bf) Add absolute bulk put and get methods
Alan Bateman
Alan.Bateman at oracle.com
Tue Oct 16 19:01:04 UTC 2018
On 16/10/2018 18:15, Brian Burkhalter wrote:
> :
>
> With respect to methods 1 and 2, a question I have concerns the exception(s) which may be thrown. In the patch, an IndexOutOfBoundsException is thrown if there is any inconsistency in the supplied parameters. This is analogous to the absolute get and put methods which handle a single value [1, 2], but is not very precise. One alternative would be instead to specify these exceptions for parameter consistency:
>
> * IllegalArgumentException if index < 0
> * IndexOutOfBoundsException if {dst,src}.length, offset, and length do not meet the preconditions
> * Buffer{Under,Over}flowException for {get,put} if index + length > capacity()
I don't have just now to go through in detail but just to say that the
existing absolute methods throw IOOBE when index is negative. They also
throw IOOBE when the index + #bytes is beyond the limit. So I think we
should keep those consistent. Also , and you noted,
Buffer{Under,Over}Exception are for the methods that get/put from the
buffer position so I don't think you'll need them here.
-Alan
More information about the nio-dev
mailing list