HexUtils Object

From Hubitat Documentation
Revision as of 21:00, 3 December 2018 by Hubitat admin (talk | contribs)
Jump to: navigation, search

Description

The package name of this class is hubitat.helper. So to use in an App or Driver you would reference it with hubitat.helper.HexUtils.

integerToHexString

Convert integer value to hex string.

Signature

String integerToHexString(int value, int minBytes)

Parameters

value - the integer value to encode
minBytes - the minmum number of hex encoded bytes, must be greater than 0

Returns

String - The value of the integer encoded as a hex string.

Example

int i = 5
def hexStr = hubitat.helper.HexUtils.integerToHexString(i, 1)

hexStringToInt

Convert hex string to integer.

Signature

int hexStringToInt(String value)

Parameters

value - the hex string to convert

Returns

int - The integer value represented by the hex string.

Example

def myInt = hubitat.helper.HexUtils.hexStringToInt("01A6")


byteArrayToHexString

Convert a byte array to hex string.

Signature

String byteArrayToHexString(byte[] value)

Parameters

value - the byte array to convert.

Returns

String - The hex string representation of the byte array.

hexStringToByteArray

Convert a hex string to a byte array.

Signature

byte[] hexStringToByteArray(String value)

intArrayToHexString

Convert an integer array to a hex string.

Signature

String intArrayToHexString(int[] value)

hexStringToIntArray

Convert a hex string into an integer array.

Signature

int[] hexStringToIntArray(String value)