src/share/classes/java/nio/Direct-X-Buffer.java.template

Print this page




 236     }
 237 
 238 #if[rw]
 239 
 240     public long address() {
 241         return address;
 242     }
 243 
 244     private long ix(int i) {
 245         return address + (i << $LG_BYTES_PER_VALUE$);
 246     }
 247 
 248     public $type$ get() {
 249         return $fromBits$($swap$(unsafe.get$Swaptype$(ix(nextGetIndex()))));
 250     }
 251 
 252     public $type$ get(int i) {
 253         return $fromBits$($swap$(unsafe.get$Swaptype$(ix(checkIndex(i)))));
 254     }
 255 






 256     public $Type$Buffer get($type$[] dst, int offset, int length) {
 257 #if[rw]
 258         if ((length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
 259             checkBounds(offset, length, dst.length);
 260             int pos = position();
 261             int lim = limit();
 262             assert (pos <= lim);
 263             int rem = (pos <= lim ? lim - pos : 0);
 264             if (length > rem)
 265                 throw new BufferUnderflowException();
 266 
 267 #if[!byte]
 268             if (order() != ByteOrder.nativeOrder())
 269                 Bits.copyTo$Memtype$Array(ix(pos), dst,
 270                                           offset << $LG_BYTES_PER_VALUE$,
 271                                           length << $LG_BYTES_PER_VALUE$);
 272             else
 273 #end[!byte]
 274                 Bits.copyToArray(ix(pos), dst, arrayBaseOffset,
 275                                  offset << $LG_BYTES_PER_VALUE$,




 236     }
 237 
 238 #if[rw]
 239 
 240     public long address() {
 241         return address;
 242     }
 243 
 244     private long ix(int i) {
 245         return address + (i << $LG_BYTES_PER_VALUE$);
 246     }
 247 
 248     public $type$ get() {
 249         return $fromBits$($swap$(unsafe.get$Swaptype$(ix(nextGetIndex()))));
 250     }
 251 
 252     public $type$ get(int i) {
 253         return $fromBits$($swap$(unsafe.get$Swaptype$(ix(checkIndex(i)))));
 254     }
 255 
 256 #if[streamableType]
 257     $type$ getUnchecked(int i) {
 258         return $fromBits$($swap$(unsafe.get$Swaptype$(ix(i))));
 259     }
 260 #end[streamableType]
 261 
 262     public $Type$Buffer get($type$[] dst, int offset, int length) {
 263 #if[rw]
 264         if ((length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
 265             checkBounds(offset, length, dst.length);
 266             int pos = position();
 267             int lim = limit();
 268             assert (pos <= lim);
 269             int rem = (pos <= lim ? lim - pos : 0);
 270             if (length > rem)
 271                 throw new BufferUnderflowException();
 272 
 273 #if[!byte]
 274             if (order() != ByteOrder.nativeOrder())
 275                 Bits.copyTo$Memtype$Array(ix(pos), dst,
 276                                           offset << $LG_BYTES_PER_VALUE$,
 277                                           length << $LG_BYTES_PER_VALUE$);
 278             else
 279 #end[!byte]
 280                 Bits.copyToArray(ix(pos), dst, arrayBaseOffset,
 281                                  offset << $LG_BYTES_PER_VALUE$,