Package co.nstant.in.cbor
Class CborEncoder
java.lang.Object
co.nstant.in.cbor.CborEncoder
public class CborEncoder extends Object
Encoder for the CBOR format based.
-
Constructor Summary
Constructors Constructor Description CborEncoder(OutputStream outputStream)Initialize a new encoder which writes the binary encoded data to anOutputStream. -
Method Summary
Modifier and Type Method Description voidencode(DataItem dataItem)Encode a singleDataItem.voidencode(List<DataItem> dataItems)Encode a list ofDataItems, also known as a stream.booleanisCanonical()CborEncodernonCanonical()
-
Constructor Details
-
CborEncoder
Initialize a new encoder which writes the binary encoded data to anOutputStream.- Parameters:
outputStream- theOutputStreamto write the encoded data to
-
-
Method Details
-
encode
Encode a list ofDataItems, also known as a stream.- Parameters:
dataItems- a list ofDataItems- Throws:
CborException- if theDataItems could not be encoded or there was an problem with theOutputStream.
-
encode
Encode a singleDataItem.- Parameters:
dataItem- theDataItemto encode. If null, encoder encodes aSimpleValueNULL value.- Throws:
CborException- ifDataItemcould not be encoded or there was an problem with theOutputStream.
-
isCanonical
public boolean isCanonical() -
nonCanonical
-