Class CBORTag

All Implemented Interfaces:
Cloneable, Comparable<CBORObject>

public class CBORTag extends CBORObject
Class for holding CBOR #6.n (tag) objects.

Tagged objects are based on CBOR major type 6. This implementation accepts multiple variants of tags:

TypeDiagnostic NotationComment
General Purpose nnn(CBOR object) Arbitrary CBOR tag
Reserved DateTime 0(ISO date string) See getDateTime()
Reserved EpochTime 1(Time stamp) See getEpochTime()
Reserved COTX 1010([Text string, CBOR object]) See getCOTXObject()
The reserved tags are verified for correctness during decoding as well as when created programmatically.

Note that the bigint type is dealt with as a specific primitive, in spite of being a tagged object.

  • Field Details

    • RESERVED_TAG_DATE_TIME

      public static final int RESERVED_TAG_DATE_TIME
      DATE_TIME tag: 0
      See Also:
    • RESERVED_TAG_EPOCH_TIME

      public static final int RESERVED_TAG_EPOCH_TIME
      EPOCH_TIME tag: 1
      See Also:
    • RESERVED_TAG_COTX

      public static final int RESERVED_TAG_COTX
      COTX tag: 1010
      See Also:
  • Constructor Details

    • CBORTag

      public CBORTag(String typeUrl, CBORObject object)
      Creates a COTX object.

      The purpose of the COTX tag is to provide a generic way of adding an object type identifier in the form of a URL or other text data to CBOR objects. Example:

      1010(["https://example.com/myobject", {
        "amount": "145.00",
        "currency": "USD"
      }])
      Parameters:
      typeUrl - Type URL (or other string)
      object - Object
    • CBORTag

      public CBORTag(long tagNumber, CBORObject object)
      Creates a CBOR tagged object.
      Parameters:
      tagNumber - Tag number
      object - Object
      Throws:
      CBORException
      IllegalArgumentException
  • Method Details