类 Jaxb2XmlDecoder
- java.lang.Object
- org.springframework.core.codec.AbstractDecoder<Object>
- org.springframework.http.codec.xml.Jaxb2XmlDecoder
public class Jaxb2XmlDecoder extends AbstractDecoder<Object>
Decode from a bytes stream containing XML elements to a stream ofObject
s (POJOs).- 从以下版本开始:
- 5.0
- 作者:
- Sebastien Deleuze, Arjen Poutsma
- 另请参阅:
Jaxb2XmlEncoder
字段概要
从类继承的字段 org.springframework.core.codec.AbstractDecoder
logger
构造器概要
构造器 构造器 说明 Jaxb2XmlDecoder()
Jaxb2XmlDecoder(MimeType... supportedMimeTypes)
Create aJaxb2XmlDecoder
with the specified MIME types.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
canDecode(ResolvableType elementType, MimeType mimeType)
Whether the decoder supports the given target element type and the MIME type of the source stream.reactor.core.publisher.Flux<Object>
decode(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decode aDataBuffer
input stream into a Flux ofT
.Object
decode(DataBuffer dataBuffer, ResolvableType targetType, MimeType mimeType, Map<String,Object> hints)
Decode a data buffer to an Object of type T.reactor.core.publisher.Mono<Object>
decodeToMono(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decode aDataBuffer
input stream into a Mono ofT
.int
getMaxInMemorySize()
Return theconfigured
byte count limit.Function<Unmarshaller,Unmarshaller>
getUnmarshallerProcessor()
Return the configured processor for customizing Unmarshaller instances.void
setMaxInMemorySize(int byteCount)
Set the max number of bytes that can be buffered by this decoder.void
setUnmarshallerProcessor(Function<Unmarshaller,Unmarshaller> processor)
Configure a processor function to customize Unmarshaller instances.从类继承的方法 org.springframework.core.codec.AbstractDecoder
getDecodableMimeTypes, getLogger, setLogger
构造器详细资料
Jaxb2XmlDecoder
public Jaxb2XmlDecoder()
Jaxb2XmlDecoder
public Jaxb2XmlDecoder(MimeType... supportedMimeTypes)
Create aJaxb2XmlDecoder
with the specified MIME types.- 参数:
supportedMimeTypes
- supported MIME types- 从以下版本开始:
- 5.1.9
方法详细资料
setUnmarshallerProcessor
public void setUnmarshallerProcessor(Function<Unmarshaller,Unmarshaller> processor)
Configure a processor function to customize Unmarshaller instances.- 参数:
processor
- the function to use- 从以下版本开始:
- 5.1.3
getUnmarshallerProcessor
public Function<Unmarshaller,Unmarshaller> getUnmarshallerProcessor()
Return the configured processor for customizing Unmarshaller instances.- 从以下版本开始:
- 5.1.3
setMaxInMemorySize
public void setMaxInMemorySize(int byteCount)
Set the max number of bytes that can be buffered by this decoder. This is either the size of the entire input when decoding as a whole, or when using async parsing with Aalto XML, it is the size of one top-level XML tree. When the limit is exceeded,DataBufferLimitException
is raised.By default this is set to 256K.
- 参数:
byteCount
- the max number of bytes to buffer, or -1 for unlimited- 从以下版本开始:
- 5.1.11
getMaxInMemorySize
public int getMaxInMemorySize()
Return theconfigured
byte count limit.- 从以下版本开始:
- 5.1.11
canDecode
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
从接口复制的说明:Decoder
Whether the decoder supports the given target element type and the MIME type of the source stream.
decode
public reactor.core.publisher.Flux<Object> decode(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
从接口复制的说明:Decoder
Decode aDataBuffer
input stream into a Flux ofT
.- 参数:
inputStream
- theDataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream; this type must have been previously passed to theDecoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returnedtrue
.mimeType
- the MIME type associated with the input stream (optional)hints
- additional information about how to do encode- 返回:
- the output stream with decoded elements
decodeToMono
public reactor.core.publisher.Mono<Object> decodeToMono(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
从接口复制的说明:Decoder
Decode aDataBuffer
input stream into a Mono ofT
.- 指定者:
decodeToMono
在接口中Decoder<Object>
- 覆盖:
decodeToMono
在类中AbstractDecoder<Object>
- 参数:
input
- theDataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream; this type must have been previously passed to theDecoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returnedtrue
.mimeType
- the MIME type associated with the input stream (optional)hints
- additional information about how to do encode- 返回:
- the output stream with the decoded element
decode
public Object decode(DataBuffer dataBuffer, ResolvableType targetType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints) throws DecodingException
从接口复制的说明:Decoder
Decode a data buffer to an Object of type T. This is useful for scenarios, that distinct messages (or events) are decoded and handled individually, in fully aggregated form.- 参数:
dataBuffer
- theDataBuffer
to decodetargetType
- the expected output typemimeType
- the MIME type associated with the datahints
- additional information about how to do encode- 返回:
- the decoded value, possibly
null
- 抛出:
DecodingException