Enum WireType
- java.lang.Object
-
- java.lang.Enum<WireType>
-
- org.infinispan.protostream.descriptors.WireType
-
- All Implemented Interfaces:
Serializable,Comparable<WireType>
public enum WireType extends Enum<WireType>
Protobuf wire encoding type. Also provide helper functions for extracting the wire type and field number out of a tag.- Since:
- 4.4
- Author:
- anistor@redhat.com
-
-
Enum Constant Summary
Enum Constants Enum Constant Description END_GROUPFIXED32FIXED64LENGTH_DELIMITEDSTART_GROUPVARINT
-
Field Summary
Fields Modifier and Type Field Description static intFIXED_32_SIZEstatic intFIXED_64_SIZEstatic intMAX_VARINT_SIZEstatic intTAG_TYPE_BIT_MASKBit mask used for extracting the lower 3 bits of a tag, which represent the wire type of the field.static intTAG_TYPE_NUM_BITSThe lower 3 bits of the 32 bit tag are used for encoding the wire type.intvalueThe protobuf protocol wire type.static intWIRETYPE_END_GROUPstatic intWIRETYPE_FIXED32static intWIRETYPE_FIXED64static intWIRETYPE_LENGTH_DELIMITEDstatic intWIRETYPE_START_GROUPstatic intWIRETYPE_VARINT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static WireTypefromTag(int tag)Extracts the WireType from a numeric tag.static WireTypefromValue(int wireType)Gets the WireType enum value corresponding to a numeric wire type.static intgetTagFieldNumber(int tag)Given a tag value, determines the field number (the upper 29 bits).static intgetTagWireType(int tag)Given a tag value, determines the wire type (the lower 3 bits).static intmakeTag(int fieldNumber, int wireType)static intmakeTag(int fieldNumber, WireType wireType)Makes a tag value given a field number and wire type.static WireTypevalueOf(String name)Returns the enum constant of this type with the specified name.static WireType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
VARINT
public static final WireType VARINT
-
FIXED64
public static final WireType FIXED64
-
LENGTH_DELIMITED
public static final WireType LENGTH_DELIMITED
-
START_GROUP
public static final WireType START_GROUP
-
END_GROUP
public static final WireType END_GROUP
-
FIXED32
public static final WireType FIXED32
-
-
Field Detail
-
WIRETYPE_VARINT
public static final int WIRETYPE_VARINT
- See Also:
- Constant Field Values
-
WIRETYPE_FIXED64
public static final int WIRETYPE_FIXED64
- See Also:
- Constant Field Values
-
WIRETYPE_LENGTH_DELIMITED
public static final int WIRETYPE_LENGTH_DELIMITED
- See Also:
- Constant Field Values
-
WIRETYPE_START_GROUP
public static final int WIRETYPE_START_GROUP
- See Also:
- Constant Field Values
-
WIRETYPE_END_GROUP
public static final int WIRETYPE_END_GROUP
- See Also:
- Constant Field Values
-
WIRETYPE_FIXED32
public static final int WIRETYPE_FIXED32
- See Also:
- Constant Field Values
-
FIXED_32_SIZE
public static final int FIXED_32_SIZE
- See Also:
- Constant Field Values
-
FIXED_64_SIZE
public static final int FIXED_64_SIZE
- See Also:
- Constant Field Values
-
MAX_VARINT_SIZE
public static final int MAX_VARINT_SIZE
- See Also:
- Constant Field Values
-
TAG_TYPE_NUM_BITS
public static final int TAG_TYPE_NUM_BITS
The lower 3 bits of the 32 bit tag are used for encoding the wire type.- See Also:
- Constant Field Values
-
TAG_TYPE_BIT_MASK
public static final int TAG_TYPE_BIT_MASK
Bit mask used for extracting the lower 3 bits of a tag, which represent the wire type of the field.- See Also:
- Constant Field Values
-
value
public final int value
The protobuf protocol wire type.
-
-
Method Detail
-
values
public static WireType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (WireType c : WireType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static WireType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
fromValue
public static WireType fromValue(int wireType) throws MalformedProtobufException
Gets the WireType enum value corresponding to a numeric wire type.- Throws:
MalformedProtobufException
-
fromTag
public static WireType fromTag(int tag) throws MalformedProtobufException
Extracts the WireType from a numeric tag.- Throws:
MalformedProtobufException
-
makeTag
public static int makeTag(int fieldNumber, WireType wireType)Makes a tag value given a field number and wire type.
-
makeTag
public static int makeTag(int fieldNumber, int wireType)
-
getTagWireType
public static int getTagWireType(int tag)
Given a tag value, determines the wire type (the lower 3 bits). Does not validate the resulting value.
-
getTagFieldNumber
public static int getTagFieldNumber(int tag)
Given a tag value, determines the field number (the upper 29 bits).
-
-