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 void
encode(DataItem dataItem)
Encode a singleDataItem
.void
encode(List<DataItem> dataItems)
Encode a list ofDataItem
s, also known as a stream.boolean
isCanonical()
CborEncoder
nonCanonical()
-
Constructor Details
-
CborEncoder
Initialize a new encoder which writes the binary encoded data to anOutputStream
.- Parameters:
outputStream
- theOutputStream
to write the encoded data to
-
-
Method Details
-
encode
Encode a list ofDataItem
s, also known as a stream.- Parameters:
dataItems
- a list ofDataItem
s- Throws:
CborException
- if theDataItem
s could not be encoded or there was an problem with theOutputStream
.
-
encode
Encode a singleDataItem
.- Parameters:
dataItem
- theDataItem
to encode. If null, encoder encodes aSimpleValue
NULL value.- Throws:
CborException
- ifDataItem
could not be encoded or there was an problem with theOutputStream
.
-
isCanonical
public boolean isCanonical() -
nonCanonical
-