org.springframework.http.codec.cbor

## Class Jackson2CborEncoder

- java.lang.Object
- - org.springframework.http.codec.json.Jackson2CodecSupport
  - - org.springframework.http.codec.json.AbstractJackson2Encoder
    - - org.springframework.http.codec.cbor.Jackson2CborEncoder

- All Implemented Interfaces:
    Encoder<Object>, HttpMessageEncoder<Object>

      public class Jackson2CborEncoder
      extends AbstractJackson2Encoder

  Encode from an `Object` to bytes of CBOR objects using Jackson. Stream encoding is not supported yet.
  Since:
    5.2
  Author:
    Sebastien Deleuze
  See Also:
    `Jackson2CborDecoder`, Add CBOR support to WebFlux

- - ### Field Summary

    - ### Fields inherited from class org.springframework.http.codec.json.Jackson2CodecSupport

      `JSON_VIEW_HINT, logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Jackson2CborEncoder()`
    `Jackson2CborEncoder(ObjectMapper mapper, MimeType... mimeTypes)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `reactor.core.publisher.Flux<DataBuffer>` | `encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)` Encode a stream of Objects of type `T` into a `DataBuffer` output stream.

    - ### Methods inherited from class org.springframework.http.codec.json.AbstractJackson2Encoder

      `canEncode, customizeWriter, encodeValue, getAnnotation, getEncodableMimeTypes, getEncodableMimeTypes, getEncodeHints, getJsonEncoding, getStreamingMediaTypes, getStreamingMediaTypeSeparator, setStreamingMediaTypes`

    - ### Methods inherited from class org.springframework.http.codec.json.Jackson2CodecSupport

      `getHints, getJavaType, getMimeTypes, getMimeTypes, getObjectMapper, getObjectMapperRegistrations, getObjectMappersForType, getParameter, logWarningIfNecessary, registerObjectMappersForType, selectObjectMapper, setObjectMapper, supportsMimeType`

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

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

- - ### Constructor Detail

    - #### Jackson2CborEncoder

          public Jackson2CborEncoder()

    - #### Jackson2CborEncoder

          public Jackson2CborEncoder(ObjectMapper mapper,
                                     MimeType... mimeTypes)

  - ### Method Detail

    - #### encode

          public reactor.core.publisher.Flux<DataBuffer> encode(Publisher<?> inputStream,
                                                                DataBufferFactory bufferFactory,
                                                                ResolvableType elementType,
                                                                MimeType mimeType,
                                                                Map<String,Object> hints)

      Description copied from interface: `Encoder`
      Encode a stream of Objects of type `T` into a `DataBuffer` output stream.
      Specified by:
        `encode` in interface `Encoder<Object>`
      Overrides:
        `encode` in class `AbstractJackson2Encoder`
      Parameters:
        `inputStream` - the input stream of Objects to encode. If the input should be encoded as a single value rather than as a stream of elements, an instance of `Mono` should be used.
        `bufferFactory` - for creating output stream `DataBuffer`'s
        `elementType` - the expected type of elements in the input stream; this type must have been previously passed to the `Encoder.canEncode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)` method and it must have returned `true`.
        `mimeType` - the MIME type for the output content (optional)
        `hints` - additional information about how to encode
      Returns:
        the output stream