public class Utils
extends java.lang.Object
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static byte |
CRC8(byte[] data)
Calculates a CRC8 value of a given byte array.
|
static byte |
getBlue(javafx.scene.paint.Color color)
Extracts the blue value out of a Color object.
|
static javafx.scene.paint.Color |
getColor(byte red,
byte green,
byte blue)
Creates a new instance of a Color object with the given color values.
|
static double |
getDouble(byte[] bytes,
int offset)
Gets the double primitive value for the given byte array.
|
static void |
getDoubleBytes(double value,
byte[] dest,
int offset)
Gets the bytes of a double primitive and stores them in the given array.
|
static byte |
getGreen(javafx.scene.paint.Color color)
Extracts the green value out of a Color object.
|
static int |
getInt(byte[] bytes,
int offset)
Gets the integer primitive value for the given byte array.
|
static void |
getIntBytes(int value,
byte[] dest,
int offset)
Gets the bytes of an integer primitive and stores them in the given array.
|
static long |
getLong(byte[] bytes,
int offset)
Gets the long primitive value for the given byte array.
|
static void |
getLongBytes(long value,
byte[] dest,
int offset)
Gets the bytes of a long primitive and stores them in the given array.
|
static byte |
getRed(javafx.scene.paint.Color color)
Extracts the red value out of a Color object.
|
public static void getDoubleBytes(double value, byte[] dest, int offset)
value
- The double primitive which has to be stored.dest
- The destination byte array.offset
- The offset in the destination array.public static double getDouble(byte[] bytes, int offset)
bytes
- The byte array containing the bytes for the double value.offset
- The offset within the array to indicate where the double is
stored.public static void getLongBytes(long value, byte[] dest, int offset)
value
- The long primitive which has to be stored.dest
- The destination byte array.offset
- The offset in the destination array.public static long getLong(byte[] bytes, int offset)
bytes
- The byte array containing the bytes for the long value.offset
- The offset within the array to indicate where the long is
stored.public static void getIntBytes(int value, byte[] dest, int offset)
value
- The integer primitive which has to be stored.dest
- The destination byte array.offset
- The offset in the destination array.public static int getInt(byte[] bytes, int offset)
bytes
- The byte array containing the bytes for the integer value.offset
- The offset within the array to indicate where the double is
stored.public static javafx.scene.paint.Color getColor(byte red, byte green, byte blue)
red
- The red value as a signed byte in the range of 0-255.green
- The green value as a signed byte in the range of 0-255.blue
- The blue value as a signed byte in the range of 0-255.public static byte getRed(javafx.scene.paint.Color color)
color
- The color objectpublic static byte getGreen(javafx.scene.paint.Color color)
color
- The color objectpublic static byte getBlue(javafx.scene.paint.Color color)
color
- The color objectpublic static byte CRC8(byte[] data)
data
- The bytes to calculate the CRC of.