Class CBORTypedObjectDecoder

java.lang.Object
org.webpki.cbor.CBORTypedObjectDecoder

public abstract class CBORTypedObjectDecoder extends Object
Base class for typed objects decoders.

Base class for CBOR object decoders that can be instantiated through a CBORTypedObjectDecoderCache. The system relies on that CBOR data is prepended by a mandatory COTX tag.

See also Typed Objects for an example.

  • Constructor Details

    • CBORTypedObjectDecoder

      public CBORTypedObjectDecoder()
      Constructor.

      Note: implementations must have a public constructor (which they get by default if no other constructor is defined).

  • Method Details

    • decode

      protected abstract void decode(CBORObject cborBody)
      IMPLEMENTER USE ONLY.

      Implementations must decode all elements associated with the specific object decoder.

      Note that "checked" exceptions must be wrapped in suitable unchecked exceptions like RuntimeException, CBORException, or CryptoException.

      Parameters:
      cborBody - COTX argument of CBORTypedObjectDecoder instance
    • enableCheckForUnread

      protected boolean enableCheckForUnread()
      IMPLEMENTER USE ONLY.

      After decode(CBORObject) has been called, the CBORTypedObjectDecoderCache will by default call CBORObject.checkForUnread(). By overriding enableCheckForUnread() and returning false, a decoder implementation can disable this check.

    • getObjectId

      public abstract String getObjectId()
      Get typed object identifier.
      Returns:
      Object Id (COTX)
    • getRoot

      public CBORObject getRoot()
      Get root of decoded CBOR.

      Note: the root points to the entire object, including the COTX tag.

      Returns:
      CBORObject