JDK-8011932 : Missing absolute methods on nio ByteBuffer
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2013-03-14
  • Updated: 2013-04-11
  • Resolved: 2013-04-11
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
ByteBuffer has a range of absolute and relative put and get methods.

However for some reason a number of ABSOLUTE methods have been left out for unknown reasons. Those ABSOLUTE methods that are missing are:

 put(int index, byte[] src)
 put(int index, byte[] src, int offset, int length)
 put(int index, ByteBuffer src)

 get(int index, byte[] dst)


JUSTIFICATION :
ByteBuffer is used in MappedByteBuffer. Here it often makes sense to use the absolute methods rather than the relative methods.

The missing methods cannot be mimic'ed without resorting to things like looping and copying one byte at a time. (which is defeats the whole purpose of having bulk methods in the first place).



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Feature complete, i.e there should be absolute bulk get and put methods.