Class NIOAccess

java.lang.Object
org.robolectric.nativeruntime.NIOAccess

public final class NIOAccess
extends Object
Analogue to libcore's NIOAccess, which provides access to some internal methods and properties of Buffer. These methods are designed to work on the JVM and get called from native code such as libnativehelper.
  • Method Summary

    Modifier and Type Method Description
    static int elementSizeShift​(Buffer buffer)
    The Android version of java.nio.Buffer has an extra final field called _elementSizeShift that only depend on the implementation of the buffer.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getBasePointer

      public 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.
    • elementSizeShift

      public static int elementSizeShift​(Buffer buffer)
      The Android version of java.nio.Buffer has an extra final field called _elementSizeShift that only depend on the implementation of the buffer. This method can be called instead when wanting to access the value of that field on the JVM.