类 XmlEventDecoder
- java.lang.Object
- org.springframework.core.codec.AbstractDecoder<XMLEvent>
- org.springframework.http.codec.xml.XmlEventDecoder
public class XmlEventDecoder extends AbstractDecoder<XMLEvent>
Decodes aDataBufferstream into a stream ofXMLEvents.Given the following XML:
<root> <child>foo</child> <child>bar</child> </root>this decoder will produce aFluxwith the following events:StartDocumentStartElementrootStartElementchildCharactersfooEndElementchildStartElementchildCharactersbarEndElementchildEndElementroot
Note that this decoder is not registered by default but is used internally by other decoders which are registered by default.
- 从以下版本开始:
- 5.0
- 作者:
- Arjen Poutsma, Sam Brannen
字段概要
从类继承的字段 org.springframework.core.codec.AbstractDecoder
logger
构造器概要
构造器 构造器 说明 XmlEventDecoder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 reactor.core.publisher.Flux<XMLEvent>decode(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)Decode aDataBufferinput stream into a Flux ofT.intgetMaxInMemorySize()Return theconfiguredbyte count limit.voidsetMaxInMemorySize(int byteCount)Set the max number of bytes that can be buffered by this decoder.从类继承的方法 org.springframework.core.codec.AbstractDecoder
canDecode, decodeToMono, getDecodableMimeTypes, getLogger, setLogger
构造器详细资料
XmlEventDecoder
public XmlEventDecoder()
方法详细资料
setMaxInMemorySize
public 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.
- 参数:
byteCount- the max number of bytes to buffer, or -1 for unlimited- 从以下版本开始:
- 5.1.11
getMaxInMemorySize
public int getMaxInMemorySize()
Return theconfiguredbyte count limit.- 从以下版本开始:
- 5.1.11
decode
public reactor.core.publisher.Flux<XMLEvent> decode(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
从接口复制的说明:DecoderDecode aDataBufferinput stream into a Flux ofT.- 参数:
input- theDataBufferinput 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