< prev index next >

src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template

Print this page
rev 11904 : 8079459: JCK test api/java_nio/ByteBuffer/index.html#GetPutXXX start failing after JDK-8026049
Description: nextPutIndex used where nextGetIndex is correct.
Reviewed-by: alanb


 460                 ? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
 461                                                                -1,
 462                                                                0,
 463                                                                size,
 464                                                                size,
 465                                                                off))
 466                 : (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
 467                                                                -1,
 468                                                                0,
 469                                                                size,
 470                                                                size,
 471                                                                off)));
 472     }
 473 
 474 
 475     // float
 476 
 477 #if[rw]
 478 
 479     public float getFloat() {
 480         int x = unsafe.getIntUnaligned(hb, byteOffset(nextPutIndex(4)), bigEndian);
 481         return Float.intBitsToFloat(x);
 482     }
 483 
 484     public float getFloat(int i) {
 485         int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
 486         return Float.intBitsToFloat(x);
 487     }
 488 
 489 #end[rw]
 490 
 491     public $Type$Buffer putFloat(float x) {
 492 #if[rw]
 493         int y = Float.floatToRawIntBits(x);
 494         unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
 495         return this;
 496 #else[rw]
 497         throw new ReadOnlyBufferException();
 498 #end[rw]
 499     }
 500 




 460                 ? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
 461                                                                -1,
 462                                                                0,
 463                                                                size,
 464                                                                size,
 465                                                                off))
 466                 : (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
 467                                                                -1,
 468                                                                0,
 469                                                                size,
 470                                                                size,
 471                                                                off)));
 472     }
 473 
 474 
 475     // float
 476 
 477 #if[rw]
 478 
 479     public float getFloat() {
 480         int x = unsafe.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
 481         return Float.intBitsToFloat(x);
 482     }
 483 
 484     public float getFloat(int i) {
 485         int x = unsafe.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
 486         return Float.intBitsToFloat(x);
 487     }
 488 
 489 #end[rw]
 490 
 491     public $Type$Buffer putFloat(float x) {
 492 #if[rw]
 493         int y = Float.floatToRawIntBits(x);
 494         unsafe.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
 495         return this;
 496 #else[rw]
 497         throw new ReadOnlyBufferException();
 498 #end[rw]
 499     }
 500 


< prev index next >