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 int |
asIntFromLittleEndianBytes(byte[] input)
Converts byte array with little endian order 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 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[] |
extractSubdata(byte[] packet,
int start,
int length) |
static int |
fromPowerLevelToDbm(int txPower)
Converts TX Power level to its decimal dBm representation.
|
static byte[] |
hexStringToByteArray(java.lang.String hexString)
Converts HEX string to byte array.
|
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 java.util.UUID |
toUUID(byte[] uuid)
Converts bytes array to UUID
|
public static int asInt(byte value)
value - the valuepublic static byte[] extractSubdata(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 asIntFromLittleEndianBytes(byte[] input)
input - the input 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 int fromPowerLevelToDbm(int txPower)
public 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 byte[] hexStringToByteArray(java.lang.String hexString)
hexString - input HEX string