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;
<p>
static final long pairDataOffset =
theUnsafe.objectFieldOffset(Pair.class.getDeclaredField("first"));
<p>
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 accessAccess
public static Access<ByteBuffer> toByteBuffer()
Access
to any ByteBuffer
.Access
to ByteBuffer
sCopyright © 2016. All rights reserved.