Class XmlEventDecoder
java.lang.Object
org.springframework.core.codec.AbstractDecoder<XMLEvent>
org.springframework.http.codec.xml.XmlEventDecoder
Decodes a 
DataBuffer stream into a stream of XMLEvents.
Given the following XML:
<root>
    <child>foo</child>
    <child>bar</child>
</root>
this decoder will produce a Flux with the following events:
- StartDocument
- StartElement- root
- StartElement- child
- Characters- foo
- EndElement- child
- StartElement- child
- Characters- bar
- EndElement- child
- EndElement- root
Note that this decoder is not registered by default but is used internally by other decoders which are registered by default.
- Since:
- 5.0
- Author:
- Arjen Poutsma, Sam Brannen
- 
Field SummaryFields inherited from class AbstractDecoderlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Flux<XMLEvent> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Decode aDataBufferinput stream into a Flux ofT.intReturn theconfiguredbyte count limit.voidsetMaxInMemorySize(int byteCount) Set the max number of bytes that can be buffered by this decoder.Methods inherited from class AbstractDecodercanDecode, decodeToMono, getDecodableMimeTypes, getLogger, setLoggerMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Decoderdecode, getDecodableMimeTypes
- 
Constructor Details- 
XmlEventDecoderpublic XmlEventDecoder()
 
- 
- 
Method Details- 
setMaxInMemorySizepublic void setMaxInMemorySize(int byteCount) Set the max number of bytes that can be buffered by this decoder. This is either the size the entire input when decoding as a whole, or when using async parsing via Aalto XML, it is size one top-level XML tree. When the limit is exceeded,DataBufferLimitExceptionis raised.By default this is set to 256K. - Parameters:
- byteCount- the max number of bytes to buffer, or -1 for unlimited
- Since:
- 5.1.11
 
- 
getMaxInMemorySize
- 
decodepublic reactor.core.publisher.Flux<XMLEvent> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:DecoderDecode aDataBufferinput stream into a Flux ofT.- Parameters:
- input- the- DataBufferinput stream to decode
- elementType- the expected type of elements in the output stream; this type must have been previously passed to the- Decoder.canDecode(ResolvableType, MimeType)method and it must have returned- true.
- mimeType- the MIME type associated with the input stream (optional)
- hints- additional information about how to do decode
- Returns:
- the output stream with decoded elements
 
 
-