Package io.deephaven.util
Class BooleanUtils
java.lang.Object
io.deephaven.util.BooleanUtils
Utilities for translating boxed
Boolean
s to/from primitive bytes.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
The byte encoding of false booleans.static final byte
The byte encoding of null booleans.static final Byte
The byte encoding of the null boolean, as a boxed Byte.static final byte
The byte encoding of true booleans. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte
booleanAsByte
(boolean booleanValue) ConvertbooleanValue
to a byte.static byte
booleanAsByte
(Boolean booleanValue) ConvertbooleanValue
to a byte.static byte[]
booleanAsByteArray
(boolean[] booleanArray) Convert an array ofbooleanValues
to an array of bytes.static byte[]
booleanAsByteArray
(Boolean[] booleanArray) Convert an array ofbooleanValues
to an array of bytes.static Boolean
byteAsBoolean
(byte byteValue) ConvertbyteValue
to a Boolean.static boolean
isNull
(byte byteValue) Check if a byte represents a null boolean.
-
Field Details
-
NULL_BOOLEAN_AS_BYTE
public static final byte NULL_BOOLEAN_AS_BYTEThe byte encoding of null booleans. Do not use to compare values, useisNull(byte)
instead.- See Also:
-
TRUE_BOOLEAN_AS_BYTE
public static final byte TRUE_BOOLEAN_AS_BYTEThe byte encoding of true booleans. Do not use to compare values, usebyteAsBoolean(byte)
instead.- See Also:
-
FALSE_BOOLEAN_AS_BYTE
public static final byte FALSE_BOOLEAN_AS_BYTEThe byte encoding of false booleans. This is the only safe value to use when comparing byte representations.- See Also:
-
NULL_BOOLEAN_AS_BYTE_BOXED
The byte encoding of the null boolean, as a boxed Byte.
-
-
Constructor Details
-
BooleanUtils
public BooleanUtils()
-
-
Method Details
-
byteAsBoolean
ConvertbyteValue
to a Boolean.- Parameters:
byteValue
- the byte to convert to a boxed boolean- Returns:
- the boxed boolean represented by byteValue
-
isNull
public static boolean isNull(byte byteValue) Check if a byte represents a null boolean.- Parameters:
byteValue
- the byte to check if it represents a null boolean- Returns:
- true if byteValue represents a null boolean
-
booleanAsByte
ConvertbooleanValue
to a byte.- Parameters:
booleanValue
- the boxed boolean value to convert to a byte- Returns:
- booleanValue represented as a byte
-
booleanAsByte
public static byte booleanAsByte(boolean booleanValue) ConvertbooleanValue
to a byte.- Parameters:
booleanValue
- the unboxed boolean value to convert to a byte- Returns:
- booleanValue represented as a byte
-
booleanAsByteArray
public static byte[] booleanAsByteArray(boolean[] booleanArray) Convert an array ofbooleanValues
to an array of bytes.- Parameters:
booleanArray
- the primitive boolean array to convert to a byte- Returns:
- booleanArray represented as a byte array
-
booleanAsByteArray
Convert an array ofbooleanValues
to an array of bytes.- Parameters:
booleanArray
- the boxed boolean array to convert to a byte- Returns:
- booleanArray represented as a byte array
-