Build 1.0_r1(from source)

java.nio
Class NIOAccess

java.lang.Object
  extended by java.nio.NIOAccess

 class NIOAccess
extends Object

A class allowing native code to access the underlying data of an NIO Buffer, breaking encapsulation in the name of efficiency.


Constructor Summary
NIOAccess()
           
 
Method Summary
(package private) static Object getBaseArray(Buffer b)
          Returns the underlying Java array containing the data of the given Buffer, or null if the Buffer is not backed by a Java array.
(package private) static int getBaseArrayOffset(Buffer b)
          Returns the offset in bytes from the start of the underlying Java array object containing the data of the given Buffer to the actual start of the data.
(package private) static long getBasePointer(Buffer b)
          Returns the underlying native pointer to the data of the given Buffer starting at the Buffer's current position, or 0 if the Buffer is not backed by native heap storage.
(package private) static int getRemainingBytes(Buffer b)
          Returns the number of bytes remaining in the given Buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NIOAccess

NIOAccess()
Method Detail

getBasePointer

static long getBasePointer(Buffer b)
Returns the underlying native pointer to the data of the given Buffer starting at the Buffer's current position, or 0 if the Buffer is not backed by native heap storage. Note that this is different than what the Harmony implementation calls a "base address."

Parameters:
Buffer - b the Buffer to be queried
Returns:
the native pointer to the Buffer's data at its current position, or 0 if there is none

getRemainingBytes

static int getRemainingBytes(Buffer b)
Returns the number of bytes remaining in the given Buffer. That is, this scales remaining() by the byte-size of elements of this Buffer.

Parameters:
Buffer - b the Buffer to be queried
Returns:
the number of remaining bytes

getBaseArray

static Object getBaseArray(Buffer b)
Returns the underlying Java array containing the data of the given Buffer, or null if the Buffer is not backed by a Java array.

Parameters:
Buffer - b the Buffer to be queried
Returns:
the Java array containing the Buffer's data, or null if there is none

getBaseArrayOffset

static int getBaseArrayOffset(Buffer b)
Returns the offset in bytes from the start of the underlying Java array object containing the data of the given Buffer to the actual start of the data. This method is only meaningful if getBaseArray() returns non-null.

Parameters:
Buffer - b the Buffer to be queried
Returns:
the data offset in bytes to the start of this Buffer's data

Build 1.0_r1(from source)

Please submit a feedback, bug or feature