Package com.igormaznitsa.jbbp.model
Class JBBPFieldArrayByte
java.lang.Object
com.igormaznitsa.jbbp.model.JBBPAbstractField
com.igormaznitsa.jbbp.model.JBBPAbstractArrayField<JBBPFieldByte>
com.igormaznitsa.jbbp.model.JBBPFieldArrayByte
- All Implemented Interfaces:
JBBPNamedField,JBBPNumericArray,Serializable,Iterable<JBBPFieldByte>
public final class JBBPFieldArrayByte
extends JBBPAbstractArrayField<JBBPFieldByte>
implements JBBPNumericArray
Describes a byte array.
- Since:
- 1.0
- See Also:
-
Field Summary
FieldsFields inherited from class com.igormaznitsa.jbbp.model.JBBPAbstractField
fieldNameInfo, payload -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getArray()Get the values of the array.booleangetAsBool(int index) Get element as boolean.intgetAsInt(int index) Get element as integer.longgetAsLong(int index) Get element as long.getElementAt(int index) Get element from the array for its index.Get the field type in string representation.getValueArrayAsObject(boolean reverseBits) Get the value array as an object.intsize()Get number of elements in the array.Methods inherited from class com.igormaznitsa.jbbp.model.JBBPAbstractArrayField
iteratorMethods inherited from class com.igormaznitsa.jbbp.model.JBBPAbstractField
getFieldName, getFieldPath, getNameInfo, getPayload, setPayloadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.igormaznitsa.jbbp.model.JBBPNumericArray
getAsBool
-
Field Details
-
array
protected final byte[] array
-
-
Constructor Details
-
JBBPFieldArrayByte
The Constructor.- Parameters:
name- the field name info, it can be null.array- the values array, it must not be null
-
-
Method Details
-
getArray
public byte[] getArray()Get the values of the array.- Returns:
- the values as a byte array
-
size
public int size()Description copied from class:JBBPAbstractArrayFieldGet number of elements in the array.- Specified by:
sizein classJBBPAbstractArrayField<JBBPFieldByte>- Returns:
- the array size
-
getElementAt
Description copied from class:JBBPAbstractArrayFieldGet element from the array for its index.- Specified by:
getElementAtin classJBBPAbstractArrayField<JBBPFieldByte>- Parameters:
index- the array index- Returns:
- the array element for its index
-
getAsInt
public int getAsInt(int index) Description copied from interface:JBBPNumericArrayGet element as integer.- Specified by:
getAsIntin interfaceJBBPNumericArray- Parameters:
index- index of element in array- Returns:
- the element as integer
-
getAsLong
public long getAsLong(int index) Description copied from interface:JBBPNumericArrayGet element as long.- Specified by:
getAsLongin interfaceJBBPNumericArray- Parameters:
index- index of element in array- Returns:
- the element as long
-
getValueArrayAsObject
Description copied from class:JBBPAbstractArrayFieldGet the value array as an object.- Specified by:
getValueArrayAsObjectin classJBBPAbstractArrayField<JBBPFieldByte>- Parameters:
reverseBits- reverse bit order in values- Returns:
- the value array as an object
-
getTypeAsString
Description copied from class:JBBPAbstractFieldGet the field type in string representation.- Specified by:
getTypeAsStringin classJBBPAbstractField- Returns:
- the string representation of field type, like 'int', 'long', 'bool [123]'
-
getAsBool
public boolean getAsBool(int index) Description copied from interface:JBBPNumericArrayGet element as boolean.- Specified by:
getAsBoolin interfaceJBBPNumericArray- Parameters:
index- index of element in array- Returns:
- the element as boolean
-