Class Cbor
- java.lang.Object
-
- com.appliedrec.verid.core2.serialization.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 streamstatic <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 CBORstatic <T> void
encodeToStream(T value, java.io.OutputStream outputStream, CborEncoder<T> encoder)
-
-
-
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 streamThe object type must be annotated with the
CborAdapter
annotation- Type Parameters:
T
- Type- Parameters:
inputStream
- Input stream containing the CBOR objecttype
- 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 CBORThe object type must be annotated with the
CborAdapter
annotation- Type Parameters:
T
- Object type- Parameters:
value
- Object to encodeoutputStream
- 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
-
-