Class CBORArray

java.lang.Object
org.webpki.cbor.CBORObject
org.webpki.cbor.CBORArray
All Implemented Interfaces:
Cloneable, Comparable<CBORObject>

public class CBORArray extends CBORObject
Class for holding CBOR array objects.
  • Constructor Details

    • CBORArray

      public CBORArray()
      Creates an empty CBOR array [].
  • Method Details

    • size

      public int size()
      Get size of the CBOR array.
      Returns:
      The number of objects in the array
    • get

      public CBORObject get(int index)
      Get object at a specific position in the CBOR array.
      Parameters:
      index - The position (0..size()-1)
      Returns:
      CBOR object
      Throws:
      IndexOutOfBoundsException - If the index is out of range.
    • add

      public CBORArray add(CBORObject cborObject)
      Add object to the CBOR array.
      Parameters:
      cborObject - Object to be appended to the array.
      Returns:
      this
    • toArray

      public CBORObject[] toArray()
      Create shallow copy of the CBOR array.
      Returns:
      Array of CBOR objects