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 an `OutputStream`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `encode​(DataItem dataItem)` | Encode a single `DataItem`.
    `void` | `encode​(List<DataItem> dataItems)` | Encode a list of `DataItem`s, also known as a stream.
    `boolean` | `isCanonical()` |
    `CborEncoder` | `nonCanonical()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CborEncoder

          public CborEncoder​(OutputStream outputStream)

      Initialize a new encoder which writes the binary encoded data to an `OutputStream`.
      Parameters:
        `outputStream` - the `OutputStream` to write the encoded data to

  - ### Method Detail

    - #### encode

          public void encode​(List<DataItem> dataItems)
                      throws CborException

      Encode a list of `DataItem`s, also known as a stream.
      Parameters:
        `dataItems` - a list of `DataItem`s
      Throws:
        `CborException` - if the `DataItem`s could not be encoded or there was an problem with the `OutputStream`.

    - #### encode

          public void encode​(DataItem dataItem)
                      throws CborException

      Encode a single `DataItem`.
      Parameters:
        `dataItem` - the `DataItem` to encode. If null, encoder encodes a `SimpleValue` NULL value.
      Throws:
        `CborException` - if `DataItem` could not be encoded or there was an problem with the `OutputStream`.

    - #### isCanonical

          public boolean isCanonical()

    - #### nonCanonical

          public CborEncoder nonCanonical()