Class CBORPairList

java.lang.Object
com.authlete.cbor.CBORItem
com.authlete.cbor.CBORPairList
  • Constructor Details

    • CBORPairList

      public CBORPairList(List<? extends CBORPair> pairs)
      A constructor with a list of key-value pairs that this CBOR map holds.
      Parameters:
      pairs - A list of key-value pairs.
    • CBORPairList

      public CBORPairList(T... pairs)
      A constructor with a list of key-value pairs that this CBOR map holds.
      Parameters:
      pairs - A list of key-value pairs.
      Since:
      1.14
  • Method Details

    • getPairs

      public List<? extends CBORPair> getPairs()
      Get the key-value pairs in this CBOR map.
      Returns:
      The key-value pairs.
    • toString

      public String toString()
      Return "{<key>: <value>, ...}".
      Overrides:
      toString in class Object
    • prettify

      protected String prettify(String indent, String indentUnit, Number tagNumber)
      Description copied from class: CBORItem
      Stringify this CBOR item and all the nested CBOR items in the pretty format.

      Subclasses should override this method as necessary.

      Overrides:
      prettify in class CBORItem
      Parameters:
      indent - The indent inherited from the upper CBOR item.
      indentUnit - Additional indent that should be added when nested CBOR items are stringified.
      tagNumber - The tag number of the tag wrapping this CBOR item. If this CBOR item is not wrapped, null is passed.
      Returns:
      The string expression of this CBOR item and all the nested CBOR items.
    • encode

      public void encode(OutputStream outputStream) throws IOException
      Description copied from class: CBORItem
      Write the CBOR representation of this instance into the output stream.
      Specified by:
      encode in class CBORItem
      Parameters:
      outputStream - The output stream to write the CBOR representation into.
      Throws:
      IOException
    • parse

      public Map<Object,Object> parse()
      Description copied from class: CBORItem
      Convert this CBORItem instance into an instance of a common Java class.
      Specified by:
      parse in class CBORItem
      Returns:
      An instance of a common Java class that represents this CBOR data item.
    • findByKey

      public CBORPair findByKey(Object key)
      Find a pair that has the specified key.
      Parameters:
      key - A pair that has the specified key.
      Returns:
      A pair that has the specified key. null if not found.
      Since:
      1.5