| Modifier and Type | Method and Description |
|---|---|
static Access<ByteBuffer> |
toByteBuffer()
Returns the
Access to any ByteBuffer. |
static Access<Bytes> |
toBytes() |
static <T> Access<T> |
unsafe()
Returns the
Access delegating getXXX(input, offset) methods to sun.misc.Unsafe.getXXX(input, offset). |
public static <T> Access<T> unsafe()
Access delegating getXXX(input, offset) methods to sun.misc.Unsafe.getXXX(input, offset).
Usage example:
class Pair {
long first, second;
static final long pairDataOffset =
theUnsafe.objectFieldOffset(Pair.class.getDeclaredField("first"));
static long hashPair(Pair pair, LongHashFunction hashFunction) {
return hashFunction.hash(pair, Accesses.unsafe(), pairDataOffset, 16L);
}
}
null is a valid input, on accepting null Unsafe just interprets
the given offset as a wild memory address.
T - the type of objects to accessAccesspublic static Access<ByteBuffer> toByteBuffer()
Access to any ByteBuffer.Access to ByteBuffersCopyright © 2015. All rights reserved.