Class Cbor


  • public class Cbor
    extends java.lang.Object
    CBOR encoder and decoder
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T decodeStream​(java.io.InputStream inputStream, java.lang.Class<T> type)
      Decode CBOR input stream
      static <T> T decodeStream​(java.io.InputStream inputStream, java.lang.Class<T> type, CborDecoder<T> decoder)  
      static <T> void encodeToStream​(T value, java.io.OutputStream outputStream)
      Encode object to output stream as CBOR
      static <T> void encodeToStream​(T value, java.io.OutputStream outputStream, CborEncoder<T> encoder)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • decodeStream

        public static <T> T decodeStream​(@NonNull
                                         java.io.InputStream inputStream,
                                         @NonNull
                                         java.lang.Class<T> type)
                                  throws java.lang.Exception
        Decode CBOR input stream

        The object type must be annotated with the CborAdapter annotation

        Type Parameters:
        T - Type
        Parameters:
        inputStream - Input stream containing the CBOR object
        type - Expected decoded object type
        Returns:
        Decoded object
        Throws:
        java.lang.Exception
      • decodeStream

        public static <T> T decodeStream​(@NonNull
                                         java.io.InputStream inputStream,
                                         @NonNull
                                         java.lang.Class<T> type,
                                         @NonNull
                                         CborDecoder<T> decoder)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • encodeToStream

        public static <T> void encodeToStream​(@NonNull
                                              T value,
                                              @NonNull
                                              java.io.OutputStream outputStream)
                                       throws java.lang.Exception
        Encode object to output stream as CBOR

        The object type must be annotated with the CborAdapter annotation

        Type Parameters:
        T - Object type
        Parameters:
        value - Object to encode
        outputStream - Output stream the encode the object into
        Throws:
        java.lang.Exception
      • encodeToStream

        public static <T> void encodeToStream​(@NonNull
                                              T value,
                                              @NonNull
                                              java.io.OutputStream outputStream,
                                              @NonNull
                                              CborEncoder<T> encoder)
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception