Class DirectAccess

java.lang.Object
org.cojen.tupl.io.DirectAccess

public class DirectAccess extends Object
Backdoor access to DirectByteBuffer.
  • Constructor Details

  • Method Details

    • prepare

      public ByteBuffer prepare(long ptr, int length)
      Returns an instance-specific thread-local ByteBuffer which references any memory address. The position is set to zero, the limit and capacity are set to the given length.
      Throws:
      UnsupportedOperationException - if not supported
    • isSupported

      public static boolean isSupported()
    • ref

      public static ByteBuffer ref(long ptr, int length)
      Returns a thread-local ByteBuffer which references any memory address. The position is set to zero, the limit and capacity are set to the given length.
      Throws:
      UnsupportedOperationException - if not supported
    • ref2

      public static ByteBuffer ref2(long ptr, int length)
      Returns a second independent thread-local ByteBuffer.
      Throws:
      UnsupportedOperationException - if not supported
    • getAddress

      public static long getAddress(Buffer buf)
    • unref

      public static void unref(ByteBuffer bb)
      Optionally unreference a buffer. The garbage collector does not attempt to free memory referenced by a ByteBuffer created by this class.