Class ProtoWire
java.lang.Object
io.micronaut.serde.protobuf.wire.ProtoWire
Protocol Buffers wire type constants and the tag/zig-zag arithmetic shared by the reader
and the writer.
- Since:
- 3.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intEnd of a deprecated group value.static final intFixed four-byte value.static final intFixed eight-byte value.static final intLength-prefixed bytes: strings, byte arrays, nested messages and packed repeated fields.static final intStart of a deprecated group value.static final intVariable-width integer. -
Method Summary
Modifier and TypeMethodDescriptionstatic intfieldNumber(int tag) Extract the field number from a tag.static inttag(int fieldNumber, int wireType) Combine a field number and wire type into a tag.static intwireType(int tag) Extract the wire type from a tag.static intzigZagDecode32(int value) ReversezigZagEncode32(int).static longzigZagDecode64(long value) ReversezigZagEncode64(long).static intzigZagEncode32(int value) Zig-zag encode a 32-bit value so that small magnitudes map to small varints.static longzigZagEncode64(long value) Zig-zag encode a 64-bit value so that small magnitudes map to small varints.
-
Field Details
-
VARINT
public static final int VARINTVariable-width integer.- See Also:
-
FIXED64
public static final int FIXED64Fixed eight-byte value.- See Also:
-
LENGTH_DELIMITED
public static final int LENGTH_DELIMITEDLength-prefixed bytes: strings, byte arrays, nested messages and packed repeated fields.- See Also:
-
START_GROUP
public static final int START_GROUPStart of a deprecated group value.- See Also:
-
END_GROUP
public static final int END_GROUPEnd of a deprecated group value.- See Also:
-
FIXED32
public static final int FIXED32Fixed four-byte value.- See Also:
-
-
Method Details
-
tag
public static int tag(int fieldNumber, int wireType) Combine a field number and wire type into a tag.- Parameters:
fieldNumber- The field numberwireType- The wire type- Returns:
- The tag
-
fieldNumber
public static int fieldNumber(int tag) Extract the field number from a tag.- Parameters:
tag- The tag- Returns:
- The field number
-
wireType
public static int wireType(int tag) Extract the wire type from a tag.- Parameters:
tag- The tag- Returns:
- The wire type
-
zigZagEncode32
public static int zigZagEncode32(int value) Zig-zag encode a 32-bit value so that small magnitudes map to small varints.- Parameters:
value- The value- Returns:
- The zig-zag encoded value
-
zigZagDecode32
public static int zigZagDecode32(int value) ReversezigZagEncode32(int).- Parameters:
value- The zig-zag encoded value- Returns:
- The value
-
zigZagEncode64
public static long zigZagEncode64(long value) Zig-zag encode a 64-bit value so that small magnitudes map to small varints.- Parameters:
value- The value- Returns:
- The zig-zag encoded value
-
zigZagDecode64
public static long zigZagDecode64(long value) ReversezigZagEncode64(long).- Parameters:
value- The zig-zag encoded value- Returns:
- The value
-