Class JacksonCborEncoder
java.lang.Object
org.springframework.http.codec.JacksonCodecSupport
org.springframework.http.codec.AbstractJacksonEncoder
org.springframework.http.codec.cbor.JacksonCborEncoder
- All Implemented Interfaces:
Encoder<Object>,HttpMessageEncoder<Object>
Encode from an
Object to bytes of CBOR objects using Jackson 3.x.
Stream encoding is currently not supported.
- Since:
- 7.0
- Author:
- Sebastien Deleuze
- See Also:
-
Field Summary
Fields inherited from class org.springframework.http.codec.JacksonCodecSupport
FILTER_PROVIDER_HINT, JSON_VIEW_HINT, logger, objectMapperRegistrations -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance with aCBORMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader).JacksonCborEncoder(tools.jackson.dataformat.cbor.CBORMapper mapper) Construct a new instance with the providedCBORMapper.JacksonCborEncoder(tools.jackson.dataformat.cbor.CBORMapper mapper, MimeType... mimeTypes) Construct a new instance with the providedCBORMapperandMimeTypes. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Encode a stream of Objects of typeTinto aDataBufferoutput stream.Methods inherited from class org.springframework.http.codec.AbstractJacksonEncoder
canEncode, customizeWriter, encodeValue, getAnnotation, getEncodableMimeTypes, getEncodableMimeTypes, getEncodeHints, getJsonEncoding, getStreamingMediaTypes, getStreamingMediaTypeSeparator, setStreamingMediaTypesMethods inherited from class org.springframework.http.codec.JacksonCodecSupport
getHints, getJavaType, getMediaTypesForProblemDetail, getMimeTypes, getMimeTypes, getObjectMapper, getObjectMapperRegistrations, getObjectMappersForType, getParameter, registerObjectMappersForType, selectObjectMapper, supportsMimeType
-
Constructor Details
-
JacksonCborEncoder
public JacksonCborEncoder()Construct a new instance with aCBORMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader). -
JacksonCborEncoder
public JacksonCborEncoder(tools.jackson.dataformat.cbor.CBORMapper mapper) Construct a new instance with the providedCBORMapper.- See Also:
-
JacksonCborEncoder
-
-
Method Details
-
encode
public reactor.core.publisher.Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:EncoderEncode a stream of Objects of typeTinto aDataBufferoutput stream.- Specified by:
encodein interfaceEncoder<Object>- Overrides:
encodein classAbstractJacksonEncoder- 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 ofMonoshould be used.bufferFactory- for creating output streamDataBuffer'selementType- the expected type of elements in the input stream; this type must have been previously passed to theEncoder.canEncode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)method and it must have returnedtrue.mimeType- the MIME type for the output content (optional)hints- additional information about how to encode- Returns:
- the output stream
-