接口 Codec<T>
public interface Codec<T>
Codec interface include encode and decode support.
- 从以下版本开始:
- 1.0.0
- 作者:
- xiemalin
-
方法概要
修饰符和类型方法说明decode(byte[] bytes) Do decode action from byte arraybyte[]Do byte encode actioncom.google.protobuf.Descriptors.DescriptorGetDescriptorto support dynamic mesage call for protocol bufferreadFrom(com.google.protobuf.CodedInputStream intput) Read object from target byte array input streamintCalculate size of target objectvoidWrite target object to byte array
-
方法详细资料
-
encode
Do byte encode action- 参数:
t- generic target object- 返回:
- encoded byte array
- 抛出:
IOException- if target object is invalid
-
decode
Do decode action from byte array- 参数:
bytes- encoded byte array- 返回:
- parse byte array to target object
- 抛出:
IOException- if byte array is invalid
-
size
Calculate size of target object- 参数:
t- target object- 返回:
- size of
- 抛出:
IOException- if target object is invalid
-
writeTo
Write target object to byte array- 参数:
t- target objectout- targetCodedOutputStream- 抛出:
IOException- if target object is invalid
-
readFrom
Read object from target byte array input stream- 参数:
intput- target input stream object- 返回:
- unserialize object
- 抛出:
IOException- if byte array is invalid
-
getDescriptor
GetDescriptorto support dynamic mesage call for protocol buffer- 返回:
Descriptors.Descriptorinstance- 抛出:
IOException- in case of createDescriptors.Descriptorfailed
-