Enum Class WireType
- All Implemented Interfaces:
Serializable
,Comparable<WireType>
,Constable
Protobuf wire encoding type. Also provide helper functions for extracting the wire type and field number out of a tag.
- Since:
- 4.4
- Author:
- [email protected]
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
Bit mask used for extracting the lower 3 bits of a tag, which represent the wire type of the field.static final int
The lower 3 bits of the 32 bit tag are used for encoding the wire type.final int
The protobuf protocol wire type.static final int
static final int
static final int
static final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic WireType
fromTag
(int tag) Extracts the WireType from a numeric tag.static WireType
fromValue
(int wireType) Gets the WireType enum value corresponding to a numeric wire type.static int
getTagFieldNumber
(int tag) Given a tag value, determines the field number (the upper 29 bits).static int
getTagWireType
(int tag) Given a tag value, determines the wire type (the lower 3 bits).static int
makeTag
(int fieldNumber, int wireType) static int
Makes a tag value given a field number and wire type.static WireType
Returns the enum constant of this class with the specified name.static WireType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
VARINT
-
FIXED64
-
LENGTH_DELIMITED
-
START_GROUP
-
END_GROUP
-
FIXED32
-
-
Field Details
-
WIRETYPE_VARINT
public static final int WIRETYPE_VARINT- See Also:
-
WIRETYPE_FIXED64
public static final int WIRETYPE_FIXED64- See Also:
-
WIRETYPE_LENGTH_DELIMITED
public static final int WIRETYPE_LENGTH_DELIMITED- See Also:
-
WIRETYPE_START_GROUP
public static final int WIRETYPE_START_GROUP- See Also:
-
WIRETYPE_END_GROUP
public static final int WIRETYPE_END_GROUP- See Also:
-
WIRETYPE_FIXED32
public static final int WIRETYPE_FIXED32- See Also:
-
FIXED_32_SIZE
public static final int FIXED_32_SIZE- See Also:
-
FIXED_64_SIZE
public static final int FIXED_64_SIZE- See Also:
-
MAX_VARINT_SIZE
public static final int MAX_VARINT_SIZE- See Also:
-
TAG_TYPE_NUM_BITS
public static final int TAG_TYPE_NUM_BITSThe lower 3 bits of the 32 bit tag are used for encoding the wire type.- See Also:
-
TAG_TYPE_BIT_MASK
public static final int TAG_TYPE_BIT_MASKBit mask used for extracting the lower 3 bits of a tag, which represent the wire type of the field.- See Also:
-
value
public final int valueThe protobuf protocol wire type.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromValue
Gets the WireType enum value corresponding to a numeric wire type.- Throws:
MalformedProtobufException
-
fromTag
Extracts the WireType from a numeric tag.- Throws:
MalformedProtobufException
-
makeTag
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).
-