public abstract class UnsafeHolder
extends java.lang.Object
hasUnsafe() returns true;| Modifier and Type | Field and Description |
|---|---|
static boolean |
littleEndian |
| Modifier and Type | Method and Description |
|---|---|
static java.nio.ByteBuffer |
allocateDirectBuffer(int size,
FreeMemory.Factory factory) |
static java.nio.ByteBuffer |
allocateDirectBuffer(long address,
int size,
FreeMemory.Factory factory) |
static void |
changeDirectBufferCleaner(java.nio.ByteBuffer buffer,
int size,
java.lang.Class<? extends FreeMemory> from,
java.lang.Class<? extends FreeMemory> to,
FreeMemory.Factory factory,
java.util.function.BiConsumer<java.lang.String,java.lang.Object> changeOwner)
Change the runnable field of Cleaner using given factory.
|
static void |
checkBounds(int arrayLength,
int offset,
int len)
Checks that the range described by
offset and size
doesn't exceed arrayLength. |
static int |
getAllocationSize(int size) |
static long |
getDirectBufferAddress(java.nio.ByteBuffer buffer) |
static sun.misc.Unsafe |
getUnsafe() |
static boolean |
hasUnsafe() |
static void |
monitorEnter(java.lang.Object obj) |
static void |
monitorExit(java.lang.Object obj) |
static InputStreamChannel |
newChannelBufferFramedInputStream(java.nio.channels.ReadableByteChannel channel,
int bufferSize) |
static OutputStreamChannel |
newChannelBufferFramedOutputStream(java.nio.channels.WritableByteChannel channel,
int bufferSize) |
static InputStreamChannel |
newChannelBufferInputStream(java.nio.channels.ReadableByteChannel channel,
int bufferSize) |
static OutputStreamChannel |
newChannelBufferOutputStream(java.nio.channels.WritableByteChannel channel,
int bufferSize) |
static java.nio.ByteBuffer |
reallocateDirectBuffer(java.nio.ByteBuffer buffer,
int newSize,
java.lang.Class<?> expectedClass,
FreeMemory.Factory factory) |
static void |
releaseDirectBuffer(java.nio.ByteBuffer buffer)
Release explicitly assuming passed ByteBuffer is a direct one.
|
static void |
releasePendingReferences() |
static boolean |
tryMonitorEnter(java.lang.Object obj,
boolean checkSelf) |
public static boolean hasUnsafe()
public static int getAllocationSize(int size)
public static java.nio.ByteBuffer allocateDirectBuffer(int size,
FreeMemory.Factory factory)
public static java.nio.ByteBuffer allocateDirectBuffer(long address,
int size,
FreeMemory.Factory factory)
public static long getDirectBufferAddress(java.nio.ByteBuffer buffer)
public static java.nio.ByteBuffer reallocateDirectBuffer(java.nio.ByteBuffer buffer,
int newSize,
java.lang.Class<?> expectedClass,
FreeMemory.Factory factory)
public static void changeDirectBufferCleaner(java.nio.ByteBuffer buffer,
int size,
java.lang.Class<? extends FreeMemory> from,
java.lang.Class<? extends FreeMemory> to,
FreeMemory.Factory factory,
java.util.function.BiConsumer<java.lang.String,java.lang.Object> changeOwner)
throws java.lang.IllegalAccessException
The provided BiConsumer is used to apply any action before actually
changing the runnable field with the boolean argument indicating whether
the current field matches "from" or if it is something else.
java.lang.IllegalAccessExceptionpublic static void releaseDirectBuffer(java.nio.ByteBuffer buffer)
public static void releasePendingReferences()
public static sun.misc.Unsafe getUnsafe()
public static boolean tryMonitorEnter(java.lang.Object obj,
boolean checkSelf)
public static void monitorEnter(java.lang.Object obj)
public static void monitorExit(java.lang.Object obj)
public static InputStreamChannel newChannelBufferInputStream(java.nio.channels.ReadableByteChannel channel, int bufferSize) throws java.io.IOException
java.io.IOExceptionpublic static OutputStreamChannel newChannelBufferOutputStream(java.nio.channels.WritableByteChannel channel, int bufferSize) throws java.io.IOException
java.io.IOExceptionpublic static InputStreamChannel newChannelBufferFramedInputStream(java.nio.channels.ReadableByteChannel channel, int bufferSize) throws java.io.IOException
java.io.IOExceptionpublic static OutputStreamChannel newChannelBufferFramedOutputStream(java.nio.channels.WritableByteChannel channel, int bufferSize) throws java.io.IOException
java.io.IOExceptionpublic static void checkBounds(int arrayLength,
int offset,
int len)
offset and size
doesn't exceed arrayLength.Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.