public final class PlatformDependent extends Object
sun.misc.Unsafe object.
You can disable the use of sun.misc.Unsafe if you specify
the system property io.netty.noUnsafe.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
canEnableTcpNoDelayByDefault()
Returns
true if and only if it is fine to enable TCP_NODELAY socket option by default. |
static boolean |
canFreeDirectBuffer()
Return
true if direct buffers can be freed using an optimized way and so memory footprint will be very
small. |
static void |
copyMemory(byte[] src,
int srcIndex,
long dstAddr,
long length) |
static void |
copyMemory(long srcAddr,
byte[] dst,
int dstIndex,
long length) |
static void |
copyMemory(long srcAddr,
long dstAddr,
long length) |
static long |
directBufferAddress(ByteBuffer buffer) |
static void |
freeDirectBuffer(ByteBuffer buffer)
Try to deallocate the specified direct
ByteBuffer. |
static byte |
getByte(long address) |
static int |
getInt(long address) |
static long |
getLong(long address) |
static Object |
getObject(Object object,
long fieldOffset) |
static short |
getShort(long address) |
static boolean |
hasJavassist()
Returns
true if and only if Javassist is available. |
static boolean |
hasUnsafe()
Return
true if sun.misc.Unsafe was found on the classpath and can be used. |
static boolean |
isAndroid()
Returns
true if and only if the current platform is Android |
static boolean |
isRoot()
Return
true if the current user is root. |
static boolean |
isUnaligned()
Returns
true if and only if java.nio.Bits.unaligned() is true. |
static boolean |
isWindows()
Return
true if the JVM is running on Windows |
static int |
javaVersion()
Return the version of Java under which this library is used.
|
static long |
objectFieldOffset(Field field) |
static void |
putByte(long address,
byte value) |
static void |
putInt(long address,
int value) |
static void |
putLong(long address,
long value) |
static void |
putShort(long address,
short value) |
public static boolean isAndroid()
true if and only if the current platform is Androidpublic static boolean isWindows()
true if the JVM is running on Windowspublic static boolean isRoot()
true if the current user is root. Note that this method returns
false if on Windows.public static int javaVersion()
public static boolean canEnableTcpNoDelayByDefault()
true if and only if it is fine to enable TCP_NODELAY socket option by default.public static boolean hasUnsafe()
true if sun.misc.Unsafe was found on the classpath and can be used.public static boolean canFreeDirectBuffer()
true if direct buffers can be freed using an optimized way and so memory footprint will be very
small.public static boolean isUnaligned()
true if and only if java.nio.Bits.unaligned() is true.public static boolean hasJavassist()
true if and only if Javassist is available.public static long directBufferAddress(ByteBuffer buffer)
public static void freeDirectBuffer(ByteBuffer buffer)
ByteBuffer. Please note this method does nothing if
the current platform does not support this operation or the specified buffer is not a direct buffer.public static long objectFieldOffset(Field field)
public static byte getByte(long address)
public static short getShort(long address)
public static int getInt(long address)
public static long getLong(long address)
public static void putByte(long address,
byte value)
public static void putShort(long address,
short value)
public static void putInt(long address,
int value)
public static void putLong(long address,
long value)
public static void copyMemory(long srcAddr,
long dstAddr,
long length)
public static void copyMemory(byte[] src,
int srcIndex,
long dstAddr,
long length)
public static void copyMemory(long srcAddr,
byte[] dst,
int dstIndex,
long length)
Copyright © 2008-2013 The Netty Project. All Rights Reserved.