public interface Codec<T>
| 限定符和类型 | 方法和说明 |
|---|---|
T |
decode(byte[] bytes)
Do decode action from byte array
|
byte[] |
encode(T t)
Do byte encode action
|
com.google.protobuf.Descriptors.Descriptor |
getDescriptor()
Get
Descriptor to support dynamic mesage call for protocol buffer |
T |
readFrom(com.google.protobuf.CodedInputStream intput)
Read object from target byte array input stream
|
int |
size(T t)
Calculate size of target object
|
void |
writeTo(T t,
com.google.protobuf.CodedOutputStream out)
Write target object to byte array
|
byte[] encode(T t) throws IOException
t - generic target objectIOException - if target object is invalidT decode(byte[] bytes) throws IOException
bytes - encoded byte arrayIOException - if byte array is invalidint size(T t) throws IOException
t - target objectIOException - if target object is invalidvoid writeTo(T t, com.google.protobuf.CodedOutputStream out) throws IOException
t - target objectout - target CodedOutputStreamIOException - if target object is invalidT readFrom(com.google.protobuf.CodedInputStream intput) throws IOException
intput - target input stream objectIOException - if byte array is invalidcom.google.protobuf.Descriptors.Descriptor getDescriptor()
throws IOException
Descriptor to support dynamic mesage call for protocol bufferDescriptors.Descriptor instanceIOException - in case of create Descriptors.Descriptor failedCopyright © 2022 Baidu, Inc.. All rights reserved.