java.lang.Object
org.cojen.tupl.io.DirectAccess
Backdoor access to DirectByteBuffer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetAddress(Buffer buf) static booleanprepare(long ptr, int length) Returns an instance-specific thread-local ByteBuffer which references any memory address.static ByteBufferref(long ptr, int length) Returns a thread-local ByteBuffer which references any memory address.static ByteBufferref2(long ptr, int length) Returns a second independent thread-local ByteBuffer.static voidunref(ByteBuffer bb) Optionally unreference a buffer.
-
Constructor Details
-
DirectAccess
public DirectAccess()- Throws:
UnsupportedOperationException- if not supported
-
-
Method Details
-
prepare
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
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
Returns a second independent thread-local ByteBuffer.- Throws:
UnsupportedOperationException- if not supported
-
getAddress
-
unref
Optionally unreference a buffer. The garbage collector does not attempt to free memory referenced by a ByteBuffer created by this class.
-