Package org.webpki.cbor
Class CBORArray
java.lang.Object
org.webpki.cbor.CBORObject
org.webpki.cbor.CBORArray
- All Implemented Interfaces:
Cloneable
,Comparable<CBORObject>
Class for holding CBOR
array
objects.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(CBORObject cborObject) Add object to the CBORarray
.get
(int index) Get object at a specific position in the CBORarray
.int
size()
Get size of the CBORarray
.toArray()
Create shallow copy of the CBORarray
.Methods inherited from class org.webpki.cbor.CBORObject
checkForUnread, clone, compareTo, encode, equals, getArray, getBigInteger, getBoolean, getBytes, getFloat16, getFloat32, getFloat64, getInt16, getInt32, getInt64, getInt8, getMap, getString, getTag, getUint16, getUint32, getUint64, getUint8, hashCode, isNull, scan, toDiagnosticNotation, toString
-
Constructor Details
-
CBORArray
public CBORArray()Creates an empty CBOR array[]
.
-
-
Method Details
-
size
public int size()Get size of the CBORarray
.- Returns:
- The number of objects in the array
-
get
Get object at a specific position in the CBORarray
.- Parameters:
index
- The position (0..size()-1)- Returns:
- CBOR object
- Throws:
IndexOutOfBoundsException
- If the index is out of range.
-
add
Add object to the CBORarray
.- Parameters:
cborObject
- Object to be appended to the array.- Returns:
this
-
toArray
Create shallow copy of the CBORarray
.- Returns:
- Array of CBOR objects
-