@Extension(value="protobuf", code=11) public class ProtobufSerializer extends AbstractSerializer
Encode: : Support MessageLite, String, SofaRequest and SofaResponse.
Decode by class mode : Support MessageLite and String.
Decode by object template : Support SofaRequest and SofaResponse.
| 构造器和说明 |
|---|
ProtobufSerializer() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
decode(AbstractByteBuf data,
Class clazz,
Map<String,String> context)
反序列化,只有类型,返回对象
|
void |
decode(AbstractByteBuf data,
Object template,
Map<String,String> context)
反序列化,已有数据,填充字段
|
AbstractByteBuf |
encode(Object object,
Map<String,String> context)
序列化
|
protected AbstractByteBuf |
encodeSofaRequest(SofaRequest sofaRequest,
Map<String,String> context) |
protected AbstractByteBuf |
encodeSofaResponse(SofaResponse sofaResponse,
Map<String,String> context) |
buildDeserializeError, buildDeserializeError, buildSerializeError, buildSerializeErrorpublic AbstractByteBuf encode(Object object, Map<String,String> context) throws SofaRpcException
Serializerobject - 对象context - 上下文SofaRpcException - 序列化异常protected AbstractByteBuf encodeSofaRequest(SofaRequest sofaRequest, Map<String,String> context) throws SofaRpcException
SofaRpcExceptionprotected AbstractByteBuf encodeSofaResponse(SofaResponse sofaResponse, Map<String,String> context) throws SofaRpcException
SofaRpcExceptionpublic Object decode(AbstractByteBuf data, Class clazz, Map<String,String> context) throws SofaRpcException
Serializerdata - 原始字节数组clazz - 期望的类型context - 上下文SofaRpcException - 序列化异常public void decode(AbstractByteBuf data, Object template, Map<String,String> context) throws SofaRpcException
Serializerdata - 原始字节数组template - 模板对象context - 上下文SofaRpcException - 序列化异常Copyright © 2008–2018 The Ant Financial. All rights reserved.