public class BooleanArrayType extends ArrayType<boolean[],Boolean>
boolean[]
array type. Does not support null arrays.
Each boolean value is encoded in two bits: end of array (00
), false (01
), or true (10
).
Four bit pairs are stored in each encoded byte, starting with the high-order bit pair.
ARRAY_SUFFIX, MAX_DIMENSIONS
name, NAME_PATTERN, REFERENCE_TYPE_NAME, signature, typeToken
Constructor and Description |
---|
BooleanArrayType() |
Modifier and Type | Method and Description |
---|---|
protected boolean[] |
createArray(List<Boolean> elements)
Create a new array instance containing the given elements.
|
protected Boolean |
getArrayElement(boolean[] array,
int index)
Get an element from the given array.
|
protected int |
getArrayLength(boolean[] array)
Get the length of the given array.
|
boolean |
hasPrefix0xff()
Determine whether any of this field type's encoded values start with a
0xff byte. |
boolean[] |
read(ByteReader reader)
Read a value from the given input.
|
void |
skip(ByteReader reader)
Read and discard a value from the given input.
|
void |
write(ByteWriter writer,
boolean[] array)
Write a value to the given output.
|
compare, convert, equals, fromParseableString, getDimensions, hashCode, toParseableString
validate
fromString, genericizeForIndex, getDefaultValue, getDefaultValueObject, getEncodingSignature, getKeyRange, getName, getTypeToken, hasPrefix0x00, toString, toString, validateAndWrite
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public boolean[] read(ByteReader reader)
FieldType
public void write(ByteWriter writer, boolean[] array)
FieldType
public void skip(ByteReader reader)
FieldType
public boolean hasPrefix0xff()
FieldType
0xff
byte.
Certain optimizations are possible when this is not the case. It is safe for this method to always return true.
Note: changing the return value of this method usually means changing the binary encoding, resulting in an incompatible type.
The implementation in FieldType
returns true
.
hasPrefix0xff
in class FieldType<boolean[]>
0xff
existsprotected int getArrayLength(boolean[] array)
ArrayType
getArrayLength
in class ArrayType<boolean[],Boolean>
array
- non-null arrayprotected Boolean getArrayElement(boolean[] array, int index)
ArrayType
getArrayElement
in class ArrayType<boolean[],Boolean>
array
- non-null arrayindex
- index of target element in array
index
protected boolean[] createArray(List<Boolean> elements)
ArrayType
createArray
in class ArrayType<boolean[],Boolean>
elements
- content for the new arrayCopyright © 2022. All rights reserved.