类 MapEntryLite<K,V>
java.lang.Object
com.baidu.bjf.remoting.protobuf.MapEntryLite<K,V>
- 类型参数:
K- the key typeV- the value type
Implements the lite version of map entry messages.
This class serves as an utility class to help do serialization/parsing of map entries. It's used in generated code
and also in the full version MapEntry message.
Protobuf internal. Users shouldn't use.
-
方法概要
修饰符和类型方法说明intcomputeMessageSize(int fieldNumber, K key, V value) Computes the message size for the provided key and value as though they were wrapped by aMapEntryLite.getKey()Gets the key.getValue()Gets the value.static <K,V> MapEntryLite<K, V> newDefaultInstance(com.google.protobuf.WireFormat.FieldType keyType, K defaultKey, com.google.protobuf.WireFormat.FieldType valueType, V defaultValue) Creates a default MapEntryLite message instance.parseEntry(com.google.protobuf.ByteString bytes, com.google.protobuf.ExtensionRegistryLite extensionRegistry) Parses an entry off of the input as aMap.Entry.voidparseInto(MapFieldLite<K, V> map, com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) Parses an entry off of the input into the map.voidserializeTo(com.google.protobuf.CodedOutputStream output, int fieldNumber, K key, V value) Serializes the provided key and value as though they were wrapped by aMapEntryLiteto the output stream.
-
方法详细资料
-
getKey
Gets the key.- 返回:
- the key
-
getValue
Gets the value.- 返回:
- the value
-
newDefaultInstance
public static <K,V> MapEntryLite<K,V> newDefaultInstance(com.google.protobuf.WireFormat.FieldType keyType, K defaultKey, com.google.protobuf.WireFormat.FieldType valueType, V defaultValue) Creates a default MapEntryLite message instance. This method is used by generated code to create the default instance for a map entry message. The created default instance should be used to create new map entry messages of the same type. For each map entry message, only one default instance should be created.- 类型参数:
K- the key typeV- the value type- 参数:
keyType- the key typedefaultKey- the default keyvalueType- the value typedefaultValue- the default value- 返回:
- the map entry lite
-
serializeTo
public void serializeTo(com.google.protobuf.CodedOutputStream output, int fieldNumber, K key, V value) throws IOException Serializes the provided key and value as though they were wrapped by aMapEntryLiteto the output stream. This helper method avoids allocation of aMapEntryLitebuilt with a key and value and is called from generated code directly.- 参数:
output- the outputfieldNumber- the field numberkey- the keyvalue- the value- 抛出:
IOException- Signals that an I/O exception has occurred.
-
computeMessageSize
Computes the message size for the provided key and value as though they were wrapped by aMapEntryLite. This helper method avoids allocation of aMapEntryLitebuilt with a key and value and is called from generated code directly.- 参数:
fieldNumber- the field numberkey- the keyvalue- the value- 返回:
- the int
-
parseEntry
public Map.Entry<K,V> parseEntry(com.google.protobuf.ByteString bytes, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException Parses an entry off of the input as aMap.Entry. This helper requires an allocation so usingparseInto(com.baidu.bjf.remoting.protobuf.MapFieldLite<K, V>, com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite)is preferred if possible.- 参数:
bytes- the bytesextensionRegistry- the extension registry- 返回:
- the map. entry
- 抛出:
IOException- Signals that an I/O exception has occurred.
-
parseInto
public void parseInto(MapFieldLite<K, V> map, com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOExceptionParses an entry off of the input into the map. This helper avoids allocaton of aMapEntryLiteby parsing directly into the providedMapFieldLite.- 参数:
map- the mapinput- the inputextensionRegistry- the extension registry- 抛出:
IOException- Signals that an I/O exception has occurred.
-