Class | Description |
---|---|
BitShiftLittleEndianByteArrayTool |
Implementation of
ByteArrayTool using bits shifting and standard
byte array operations. |
ByteArrayTool |
Front-end class for operations over byte arrays.
|
UnsafeByteArrayTool |
Implementation of
ByteArrayTool using sun.misc.Unsafe . |
This package contains one public frontend class ByteArrayTool
with two implementations -
main one (UnsafeByteArrayTool
) that uses Unsafe
and fallback one (BitShiftLittleEndianByteArrayTool
) that uses bit shifting.
It contains operations for reading and writing primitives from/into byte arrays and additional
copy operation.
All operations with Unsafe
are done using platform endianness (little endian on most platform),
bitshift backend always uses little endian byte order.
With Unsafe
backend all operations have boundary checks using
assert keyword.
With assertions enabled in runtime (-ea
java switch) illegal memory access will thow AssertionError
.
Without assertions illegal memory access will crash JVM.
Usage example (in tests): github link
Copyright © 2014. All Rights Reserved.