类 ResourceRegionEncoder
java.lang.Object
cn.taketoday.core.codec.AbstractEncoder<ResourceRegion>
cn.taketoday.core.codec.ResourceRegionEncoder
- 所有已实现的接口:
Encoder<ResourceRegion>
Encoder for
ResourceRegions.- 从以下版本开始:
- 4.0
- 作者:
- Brian Clozel, Harry Yang
-
字段概要
字段修饰符和类型字段说明static final StringThe hint key that contains the boundary string.private final intstatic final intThe default buffer size used by the encoder.从类继承的字段 cn.taketoday.core.codec.AbstractEncoder
logger -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleancanEncode(ResolvableType elementType, MimeType mimeType) Whether the encoder supports the given source element type and the MIME type for the output stream.private OptionalLongcontentLength(Resource resource) Determine, if possible, the contentLength of the given resource without reading it.reactor.core.publisher.Flux<DataBuffer>encode(org.reactivestreams.Publisher<? extends ResourceRegion> input, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Encode a stream of Objects of typeTinto aDataBufferoutput stream.private byte[]getContentRangeHeader(ResourceRegion region) private DataBuffergetRegionSuffix(DataBufferFactory bufferFactory, String boundaryString) private byte[]toAsciiBytes(String in) private reactor.core.publisher.Flux<DataBuffer>writeResourceRegion(ResourceRegion region, DataBufferFactory bufferFactory, Map<String, Object> hints) 从类继承的方法 cn.taketoday.core.codec.AbstractEncoder
getEncodableMimeTypes, getLogger, setLogger从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.core.codec.Encoder
encodeValue, getEncodableMimeTypes
-
字段详细资料
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZEThe default buffer size used by the encoder.- 另请参阅:
-
BOUNDARY_STRING_HINT
The hint key that contains the boundary string. -
bufferSize
private final int bufferSize
-
-
构造器详细资料
-
ResourceRegionEncoder
public ResourceRegionEncoder() -
ResourceRegionEncoder
public ResourceRegionEncoder(int bufferSize)
-
-
方法详细资料
-
canEncode
从接口复制的说明:EncoderWhether the encoder supports the given source element type and the MIME type for the output stream.- 指定者:
canEncode在接口中Encoder<ResourceRegion>- 覆盖:
canEncode在类中AbstractEncoder<ResourceRegion>- 参数:
elementType- the type of elements in the source streammimeType- the MIME type for the output stream (can benullif not specified)- 返回:
trueif supported,falseotherwise
-
encode
public reactor.core.publisher.Flux<DataBuffer> encode(org.reactivestreams.Publisher<? extends ResourceRegion> input, DataBufferFactory bufferFactory, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) 从接口复制的说明:EncoderEncode a stream of Objects of typeTinto aDataBufferoutput stream.- 参数:
input- 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(cn.taketoday.core.ResolvableType, cn.taketoday.util.MimeType)method and it must have returnedtrue.mimeType- the MIME type for the output content (optional)hints- additional information about how to encode- 返回:
- the output stream
-
writeResourceRegion
private reactor.core.publisher.Flux<DataBuffer> writeResourceRegion(ResourceRegion region, DataBufferFactory bufferFactory, @Nullable Map<String, Object> hints) -
getRegionSuffix
-
toAsciiBytes
-
getContentRangeHeader
-
contentLength
Determine, if possible, the contentLength of the given resource without reading it.- 参数:
resource- the resource instance- 返回:
- the contentLength of the resource
-