类 GenericProtobufSerialization
- java.lang.Object
-
- org.apache.dubbo.common.serialize.protobuf.support.GenericProtobufSerialization
-
- 所有已实现的接口:
Serialization
public class GenericProtobufSerialization extends Object implements Serialization
Currently, the Dubbo protocol / framework data, such as attachments, event data, etc., depends on business layer serialization protocol to do serialization before transmitted. That's a problem when using Protobuf as business serialization protocol, because Protobuf does not support raw java Object types, to solve it, we can use one of the following methods:
- 1. Package these data with Protobuf so that they can be serialized.
- 2. Separate the serialization of Dubbo protocol/framework and the service args (easy to cross-platform, cross-language serialization) to avoid the binding of this part and serialization protocol.
-
-
构造器概要
构造器 构造器 说明 GenericProtobufSerialization()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ObjectInputdeserialize(URL url, InputStream input)Get a deserialization implementation instanceStringgetContentType()Get content typebytegetContentTypeId()Get content type unique id, recommended that custom implementations use values different with any value ofConstantsand don't greater than ExchangeCodec.SERIALIZATION_MASK (31) because dubbo protocol use 5 bits to record serialization ID in header.ObjectOutputserialize(URL url, OutputStream output)Get a serialization implementation instance
-
-
-
方法详细资料
-
getContentTypeId
public byte getContentTypeId()
从接口复制的说明:SerializationGet content type unique id, recommended that custom implementations use values different with any value ofConstantsand don't greater than ExchangeCodec.SERIALIZATION_MASK (31) because dubbo protocol use 5 bits to record serialization ID in header.- 指定者:
getContentTypeId在接口中Serialization- 返回:
- content type id
-
getContentType
public String getContentType()
从接口复制的说明:SerializationGet content type- 指定者:
getContentType在接口中Serialization- 返回:
- content type
-
serialize
public ObjectOutput serialize(URL url, OutputStream output)
从接口复制的说明:SerializationGet a serialization implementation instance- 指定者:
serialize在接口中Serialization- 参数:
url- URL address for the remote serviceoutput- the underlying output stream- 返回:
- serializer
-
deserialize
public ObjectInput deserialize(URL url, InputStream input)
从接口复制的说明:SerializationGet a deserialization implementation instance- 指定者:
deserialize在接口中Serialization- 参数:
url- URL address for the remote serviceinput- the underlying input stream- 返回:
- deserializer
-
-