Пример #1
0
  private static boolean canFreeDirectBuffer0() {
    if (isAndroid()) {
      return false;
    }

    return PlatformDependent0.canFreeDirectBuffer();
  }
Пример #2
0
  private static boolean isUnaligned0() {
    if (!hasUnsafe()) {
      return false;
    }

    return PlatformDependent0.isUnaligned();
  }
Пример #3
0
  private static boolean hasUnsafe0() {
    if (isAndroid()) {
      return false;
    }

    boolean noUnsafe = SystemPropertyUtil.getBoolean("io.netty.noUnsafe", false);
    if (noUnsafe) {
      return false;
    }

    // Legacy properties
    boolean tryUnsafe;
    if (SystemPropertyUtil.contains("io.netty.tryUnsafe")) {
      tryUnsafe = SystemPropertyUtil.getBoolean("io.netty.tryUnsafe", true);
    } else {
      tryUnsafe = SystemPropertyUtil.getBoolean("org.jboss.netty.tryUnsafe", true);
    }

    if (!tryUnsafe) {
      return false;
    }

    return PlatformDependent0.hasUnsafe();
  }
Пример #4
0
 public static long directBufferAddress(ByteBuffer buffer) {
   return PlatformDependent0.directBufferAddress(buffer);
 }
Пример #5
0
 public static void copyMemory(long srcAddr, long dstAddr, long length) {
   PlatformDependent0.copyMemory(srcAddr, dstAddr, length);
 }
Пример #6
0
 public static void putInt(long address, int value) {
   PlatformDependent0.putInt(address, value);
 }
Пример #7
0
 public static void putLong(long address, long value) {
   PlatformDependent0.putLong(address, value);
 }
Пример #8
0
 public static void putByte(long address, byte value) {
   PlatformDependent0.putByte(address, value);
 }
Пример #9
0
 public static void putShort(long address, short value) {
   PlatformDependent0.putShort(address, value);
 }
Пример #10
0
 public static int getInt(long address) {
   return PlatformDependent0.getInt(address);
 }
Пример #11
0
 public static long getLong(long address) {
   return PlatformDependent0.getLong(address);
 }
Пример #12
0
 public static short getShort(long address) {
   return PlatformDependent0.getShort(address);
 }
Пример #13
0
 public static byte getByte(long address) {
   return PlatformDependent0.getByte(address);
 }
Пример #14
0
 public static long objectFieldOffset(Field field) {
   return PlatformDependent0.objectFieldOffset(field);
 }
Пример #15
0
 public static Object getObject(Object object, long fieldOffset) {
   return PlatformDependent0.getObject(object, fieldOffset);
 }
Пример #16
0
 /**
  * Try to deallocate the specified direct {@link 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 void freeDirectBuffer(ByteBuffer buffer) {
   if (canFreeDirectBuffer() && buffer.isDirect()) {
     PlatformDependent0.freeDirectBuffer(buffer);
   }
 }