Package org.greenrobot.essentials
Class PrimitiveArrayUtils.UnsafeImpl
- java.lang.Object
-
- org.greenrobot.essentials.PrimitiveArrayUtils
-
- org.greenrobot.essentials.PrimitiveArrayUtils.UnsafeImpl
-
- Enclosing class:
- PrimitiveArrayUtils
private static class PrimitiveArrayUtils.UnsafeImpl extends PrimitiveArrayUtils
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
BIG_ENDIAN
private static long
BYTE_ARRAY_OFFSET
Set only if UNALIGNED == true.private static long
CHAR_ARRAY_OFFSET
Set only if UNALIGNED == true.private static boolean
UNALIGNED
private static sun.misc.Unsafe
UNSAFE
Set only if UNALIGNED == true.
-
Constructor Summary
Constructors Modifier Constructor Description private
UnsafeImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIntBE(byte[] bytes, int index)
Big endian.int
getIntLE(byte[] bytes, int index)
Little endian.int
getIntLE(char[] chars, int index)
Little endian.long
getLongBE(byte[] bytes, int index)
Big endian.long
getLongLE(byte[] bytes, int index)
Little endian.private static boolean
guessUnalignedFromOsArch()
private static boolean
initUnaligned()
private static sun.misc.Unsafe
initUnsafe()
-
Methods inherited from class org.greenrobot.essentials.PrimitiveArrayUtils
getInstance, getInstanceSafe, initUnsafeInstance
-
-
-
-
Field Detail
-
BIG_ENDIAN
private static final boolean BIG_ENDIAN
-
UNALIGNED
private static final boolean UNALIGNED
-
UNSAFE
private static final sun.misc.Unsafe UNSAFE
Set only if UNALIGNED == true.
-
BYTE_ARRAY_OFFSET
private static final long BYTE_ARRAY_OFFSET
Set only if UNALIGNED == true.
-
CHAR_ARRAY_OFFSET
private static final long CHAR_ARRAY_OFFSET
Set only if UNALIGNED == true.
-
-
Method Detail
-
initUnaligned
private static boolean initUnaligned()
-
guessUnalignedFromOsArch
private static boolean guessUnalignedFromOsArch()
-
initUnsafe
private static sun.misc.Unsafe initUnsafe()
-
getIntLE
public int getIntLE(byte[] bytes, int index)
Little endian.- Specified by:
getIntLE
in classPrimitiveArrayUtils
-
getIntLE
public int getIntLE(char[] chars, int index)
Little endian.- Specified by:
getIntLE
in classPrimitiveArrayUtils
-
getIntBE
public int getIntBE(byte[] bytes, int index)
Big endian.- Specified by:
getIntBE
in classPrimitiveArrayUtils
-
getLongLE
public long getLongLE(byte[] bytes, int index)
Little endian.- Specified by:
getLongLE
in classPrimitiveArrayUtils
-
getLongBE
public long getLongBE(byte[] bytes, int index)
Big endian.- Specified by:
getLongBE
in classPrimitiveArrayUtils
-
-