Package at.qubic.api.util
Class AssetUtil
java.lang.Object
at.qubic.api.util.AssetUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]nameTo8Bytes(String name) Return input string as byte[8].static StringnameToString(byte[] name) Creates an ascii string out of the specified input byte array.static byte[]unitOfMeasurementTo8Bytes(String unitOfMeasurement) Converts a unit of measurement string to bytes.static StringunitOfMeasurementToString(byte[] input) Converts a units of measurement array to a readable string.
-
Constructor Details
-
AssetUtil
public AssetUtil()
-
-
Method Details
-
nameToString
Creates an ascii string out of the specified input byte array. Null characters are trimmed.- Parameters:
name- The byte array containing the name.- Returns:
- The byte array converted to a string.
-
nameTo8Bytes
Return input string as byte[8]. The last byte is zero (null terminated string).- Parameters:
name- The input string. Shouldn't be more than 7 bytes. Other bytes are ignored.- Returns:
- The name as null terminated byte array of length 8.
-
unitOfMeasurementTo8Bytes
Converts a unit of measurement string to bytes. Letters are mapped to their corresponding byte value. "00000020" is converted to byte {0,0,0,0,0,0,2,0} for example.- Parameters:
unitOfMeasurement- String describing the units of measurement for an asset.- Returns:
- The units of measurement in byte array format.
-
unitOfMeasurementToString
Converts a units of measurement array to a readable string. byte values are mapped to their corresponding ascii letters, for example 0 is mapped to the '0' characters.- Parameters:
input- The units of measurement bytes. Only the first 7 bytes are converted.- Returns:
- An ascii string representing the units of measurement.
-