Top Description Constructors Methods
org.springframework.http.codec.cbor

public Class Jackson2CborEncoder

extends AbstractJackson2Encoder
Class Inheritance
Imports
java.util.Map, com.fasterxml.jackson.databind.ObjectMapper, com.fasterxml.jackson.dataformat.cbor.CBORFactory, org.reactivestreams.Publisher, reactor.core.publisher.Flux, org.springframework.core.ResolvableType, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, org.springframework.http.MediaType, org.springframework.http.codec.json.AbstractJackson2Encoder, org.springframework.http.converter.json.Jackson2ObjectMapperBuilder, org.springframework.util.Assert, .MimeType

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

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public Flux<DataBuffer>
encode(Publisher<?>
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.
inputStream
,
DataBufferFactory
for creating output stream DataBuffer's
bufferFactory
,
ResolvableType
the expected type of elements in the input stream; this type must have been previously passed to the canEncode method and it must have returned true.
elementType
,
MimeType
the MIME type for the output content (optional)
mimeType
,
Map<String, Object>
additional information about how to encode
hints
)

Overrides org.springframework.http.codec.json.AbstractJackson2Encoder.encode.

Implements org.springframework.core.codec.Encoder.encode.

Encode a stream of Objects of type T into a DataBuffer output stream.

Inherited from org.springframework.http.codec.json.AbstractJackson2Encoder:
canEncodecustomizeWriterencodeValuegetAnnotationgetEncodableMimeTypesgetEncodableMimeTypesgetEncodeHintsgetJsonEncodinggetStreamingMediaTypesgetStreamingMediaTypeSeparatorsetStreamingMediaTypes

Constructor Detail

Jackson2CborEncoderback to summary
public Jackson2CborEncoder()
Jackson2CborEncoderback to summary
public Jackson2CborEncoder(ObjectMapper mapper, MimeType... mimeTypes)

Method Detail

encodeback to summary
public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints)

Overrides org.springframework.http.codec.json.AbstractJackson2Encoder.encode.

Implements org.springframework.core.codec.Encoder.encode.

Doc from org.springframework.core.codec.Encoder.encode.

Encode a stream of Objects of type T into a DataBuffer output stream.

Parameters
inputStream:Publisher<?>

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:DataBufferFactory

for creating output stream DataBuffer's

elementType:ResolvableType

the expected type of elements in the input stream; this type must have been previously passed to the canEncode method and it must have returned true.

mimeType:MimeType

the MIME type for the output content (optional)

hints:Map<String, Object>

additional information about how to encode

Returns:Flux<DataBuffer>

the output stream

Annotations
@Override