Package org.greenrobot.essentials
Class PrimitiveArrayUtils.UnsafeImpl
java.lang.Object
org.greenrobot.essentials.PrimitiveArrayUtils
org.greenrobot.essentials.PrimitiveArrayUtils.UnsafeImpl
- Enclosing class:
PrimitiveArrayUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final boolean
private static final long
Set only if UNALIGNED == true.private static final long
Set only if UNALIGNED == true.private static final boolean
private static final sun.misc.Unsafe
Set only if UNALIGNED == true. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
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
private static boolean
private static sun.misc.Unsafe
Methods inherited from class org.greenrobot.essentials.PrimitiveArrayUtils
getInstance, getInstanceSafe, initUnsafeInstance
-
Field Details
-
BIG_ENDIAN
private static final boolean BIG_ENDIAN -
UNALIGNED
private static final boolean UNALIGNED -
UNSAFE
private static final sun.misc.Unsafe UNSAFESet only if UNALIGNED == true. -
BYTE_ARRAY_OFFSET
private static final long BYTE_ARRAY_OFFSETSet only if UNALIGNED == true. -
CHAR_ARRAY_OFFSET
private static final long CHAR_ARRAY_OFFSETSet only if UNALIGNED == true.
-
-
Constructor Details
-
UnsafeImpl
private UnsafeImpl()
-
-
Method Details
-
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
-