类 ProtobufEncoder
java.lang.Object
cn.taketoday.http.codec.protobuf.ProtobufCodecSupport
cn.taketoday.http.codec.protobuf.ProtobufEncoder
- 所有已实现的接口:
cn.taketoday.core.codec.Encoder<com.google.protobuf.Message>,HttpMessageEncoder<com.google.protobuf.Message>
public class ProtobufEncoder
extends ProtobufCodecSupport
implements HttpMessageEncoder<com.google.protobuf.Message>
An
Encoder that writes Messages
using Google Protocol Buffers.
Flux are serialized using delimited Protobuf messages with the size of each message specified before the message itself. Single values are serialized using regular Protobuf message format (without the size prepended before the message).
To generate Message Java classes, you need to install the protoc binary.
This encoder requires Protobuf 3 or higher, and supports
"application/x-protobuf" and "application/octet-stream" with the official
"com.google.protobuf:protobuf-java" library.
- 从以下版本开始:
- 4.0
- 作者:
- Sebastien Deleuze
- 另请参阅:
-
字段概要
字段从类继承的字段 cn.taketoday.http.codec.protobuf.ProtobufCodecSupport
DELIMITED_KEY, DELIMITED_VALUE, MIME_TYPES -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleancanEncode(cn.taketoday.core.ResolvableType elementType, cn.taketoday.util.MimeType mimeType) reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer>encode(org.reactivestreams.Publisher<? extends com.google.protobuf.Message> inputStream, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, cn.taketoday.core.ResolvableType elementType, cn.taketoday.util.MimeType mimeType, Map<String, Object> hints) private cn.taketoday.core.io.buffer.DataBufferencodeValue(com.google.protobuf.Message message, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, boolean delimited) cn.taketoday.core.io.buffer.DataBufferencodeValue(com.google.protobuf.Message message, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, cn.taketoday.core.ResolvableType valueType, cn.taketoday.util.MimeType mimeType, Map<String, Object> hints) List<cn.taketoday.util.MimeType>Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.从类继承的方法 cn.taketoday.http.codec.protobuf.ProtobufCodecSupport
getMimeTypes, supportsMimeType从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.core.codec.Encoder
getEncodableMimeTypes从接口继承的方法 cn.taketoday.http.codec.HttpMessageEncoder
getEncodeHints
-
字段详细资料
-
streamingMediaTypes
-
-
构造器详细资料
-
ProtobufEncoder
public ProtobufEncoder()
-
-
方法详细资料
-
canEncode
public boolean canEncode(cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType) - 指定者:
canEncode在接口中cn.taketoday.core.codec.Encoder<com.google.protobuf.Message>
-
encode
public reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer> encode(org.reactivestreams.Publisher<? extends com.google.protobuf.Message> inputStream, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String, Object> hints) - 指定者:
encode在接口中cn.taketoday.core.codec.Encoder<com.google.protobuf.Message>
-
encodeValue
public cn.taketoday.core.io.buffer.DataBuffer encodeValue(com.google.protobuf.Message message, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, cn.taketoday.core.ResolvableType valueType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String, Object> hints) - 指定者:
encodeValue在接口中cn.taketoday.core.codec.Encoder<com.google.protobuf.Message>
-
encodeValue
private cn.taketoday.core.io.buffer.DataBuffer encodeValue(com.google.protobuf.Message message, cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory, boolean delimited) -
getStreamingMediaTypes
从接口复制的说明:HttpMessageEncoderReturn "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.- 指定者:
getStreamingMediaTypes在接口中HttpMessageEncoder<com.google.protobuf.Message>
-
getEncodableMimeTypes
- 指定者:
getEncodableMimeTypes在接口中cn.taketoday.core.codec.Encoder<com.google.protobuf.Message>
-