类 AbstractDataBufferDecoder<T>
- java.lang.Object
- org.springframework.core.codec.AbstractDecoder<T>
- org.springframework.core.codec.AbstractDataBufferDecoder<T>
- 类型参数:
T
- the element type
- 所有已实现的接口:
Decoder<T>
public abstract class AbstractDataBufferDecoder<T> extends AbstractDecoder<T>
Abstract base class forDecoder
implementations that can decode aDataBuffer
directly to the target element type.Sub-classes must implement
decodeDataBuffer(org.springframework.core.io.buffer.DataBuffer, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)
to provide a way to transform aDataBuffer
to the target data type. The defaultdecode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)
implementation transforms each individual data buffer whiledecodeToMono(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)
applies "reduce" and transforms the aggregated buffer.Sub-classes can override
decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>)
in order to split the input stream along different boundaries (e.g. on new line characters forString
) or always reduce to a single data buffer (e.g.Resource
).- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
字段概要
从类继承的字段 org.springframework.core.codec.AbstractDecoder
logger
构造器概要
构造器 限定符 构造器 说明 protected
AbstractDataBufferDecoder(MimeType... supportedMimeTypes)
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 reactor.core.publisher.Flux<T>
decode(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decode aDataBuffer
input stream into a Flux ofT
.protected T
decodeDataBuffer(DataBuffer buffer, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
已过时。as of 5.2, please implementDecoder.decode(DataBuffer, ResolvableType, MimeType, Map)
insteadreactor.core.publisher.Mono<T>
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.void
setMaxInMemorySize(int byteCount)
Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated.从类继承的方法 org.springframework.core.codec.AbstractDecoder
canDecode, getDecodableMimeTypes, getLogger, setLogger
构造器详细资料
AbstractDataBufferDecoder
protected AbstractDataBufferDecoder(MimeType... supportedMimeTypes)
方法详细资料
setMaxInMemorySize
public void setMaxInMemorySize(int byteCount)
Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated. This can be a result of decoding to a singleDataBuffer
,ByteBuffer
,byte[]
,Resource
,String
, etc. It can also occur when splitting the input stream, e.g. delimited text, in which case the limit applies to data buffered between delimiters.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
decode
public reactor.core.publisher.Flux<T> decode(org.reactivestreams.Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
从接口复制的说明:Decoder
Decode aDataBuffer
input stream into a Flux ofT
.- 参数:
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 decoded elements
decodeToMono
public reactor.core.publisher.Mono<T> 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<T>
- 覆盖:
decodeToMono
在类中AbstractDecoder<T>
- 参数:
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
decodeDataBuffer
@Deprecated @Nullable protected T decodeDataBuffer(DataBuffer buffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
已过时。as of 5.2, please implementDecoder.decode(DataBuffer, ResolvableType, MimeType, Map)
insteadHow to decode aDataBuffer
to the target element type.