Class CBORParser

java.lang.Object
com.authlete.cbor.CBORParser

public class CBORParser extends Object
A parser that receives CBOR data items (CBORItem) from the CBOR decoder (CBORDecoder) converts them into instances of common Java classes.
See Also:
  • Constructor Details

    • CBORParser

      public CBORParser(byte[] input)
      A constructor with a byte array that holds CBOR data items.

      This constructor is an alias of CBORParser(new CBORDecoder(input)).

      Parameters:
      input - A byte array that holds CBOR data items.
    • CBORParser

      public CBORParser(InputStream inputStream)
      A constructor with an input stream to read CBOR data items from.

      This constructor is an alias of CBORParser(new CBORDecoder(inputStream)).

      Parameters:
      inputStream - An input stream to read CBOR data items from.
    • CBORParser

      public CBORParser(CBORDecoder decoder)
      A constructor with a CBOR decoder.
      Parameters:
      decoder - A CBOR decoder used to decode CBOR data items in the input stream. Must not be null.
  • Method Details

    • next

      public Object next() throws IOException
      Get the next CBOR data item from the input stream and convert it into an instance of a common Java class.
      Returns:
      An object that represents a CBOR data item. When no more CBOR data item is available, null is returned.
      Throws:
      IOException
    • all

      public List<Object> all() throws IOException
      Read all the CBOR data items from the input stream.
      Returns:
      A list of CBOR data items read from the input stream.
      Throws:
      IOException
      Since:
      1.1
    • getDecoder

      public CBORDecoder getDecoder()
      Get the CBOR decoder used to decode CBOR data items in the input stream.
      Returns:
      The CBOR decoder.