public final class ConversionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
asInt(byte value)
Converts byte to integer value.
|
static int |
asInt(byte[] input)
Converts array into integer value.
|
static boolean |
contains(byte[] source,
int valueToFind) |
static boolean |
containsScanResponse(byte[] scanRecord) |
static byte[] |
convert(java.io.File file)
Converts File to bytes of array.
|
static byte[] |
convert(java.util.UUID uuid)
Converts UUID (
UUID ) to bytes array. |
static byte[] |
convertPowerLevel(int powerLevel)
Converts power level to bytes array which can be accepted by Beacon.
|
static boolean |
doesArrayBeginWith(byte[] array,
byte[] prefix)
checkes whether array starts with the byte sequence specified in prefix array.
|
static boolean |
doesArrayContainSubset(byte[] src,
byte[] subset,
int startIndex) |
static byte[] |
extractEddystonePacketPayload(byte[] packet,
int start,
int length) |
static byte[] |
invert(byte[] array)
Inverts bytes array.
|
static byte[] |
to2ByteArray(int value)
Converts integer value to 2-byte array.
|
static int |
toPowerLevel(byte[] byteValue)
Converts bytes array to Beacon power level.
|
static int |
toPowerLevel(int value)
Converts integer value to power level.
|
static int[] |
toPrimitive(java.lang.Integer[] array)
Converts an array of object Integers to primitives.
|
static java.util.UUID |
toUUID(byte[] uuid)
Converts bytes array to UUID
|
public static int asInt(byte value)
value
- the valuepublic static byte[] extractEddystonePacketPayload(byte[] packet, int start, int length)
public static boolean doesArrayBeginWith(byte[] array, byte[] prefix)
array
- the arrayprefix
- the prefix arraypublic static byte[] invert(byte[] array)
array
- the arraypublic static int asInt(byte[] input)
input
- the input arraypublic static byte[] to2ByteArray(int value)
value
- the valuepublic static byte[] convert(java.util.UUID uuid)
UUID
) to bytes array.uuid
- the uuidpublic static byte[] convert(java.io.File file) throws java.io.IOException
file
- the filejava.io.IOException
- the iO exceptionpublic static int toPowerLevel(byte[] byteValue)
byteValue
- the byte valuepublic static int toPowerLevel(int value)
value
- the valuepublic static byte[] convertPowerLevel(int powerLevel)
powerLevel
- the power levelpublic static java.util.UUID toUUID(byte[] uuid)
uuid
- the byte arraypublic static boolean doesArrayContainSubset(byte[] src, byte[] subset, int startIndex)
public static boolean containsScanResponse(byte[] scanRecord)
public static boolean contains(byte[] source, int valueToFind)
public static int[] toPrimitive(java.lang.Integer[] array)
Converts an array of object Integers to primitives.
This method returns null
for a null
input array.
array
- a Integer
array, may be null
int
array, null
if null array inputjava.lang.NullPointerException
- if array content is null