Class ProtoWire

java.lang.Object
io.micronaut.serde.protobuf.wire.ProtoWire

@Internal public final class ProtoWire extends Object
Protocol Buffers wire type constants and the tag/zig-zag arithmetic shared by the reader and the writer.
Since:
3.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    End of a deprecated group value.
    static final int
    Fixed four-byte value.
    static final int
    Fixed eight-byte value.
    static final int
    Length-prefixed bytes: strings, byte arrays, nested messages and packed repeated fields.
    static final int
    Start of a deprecated group value.
    static final int
    Variable-width integer.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    fieldNumber(int tag)
    Extract the field number from a tag.
    static int
    tag(int fieldNumber, int wireType)
    Combine a field number and wire type into a tag.
    static int
    wireType(int tag)
    Extract the wire type from a tag.
    static int
    zigZagDecode32(int value)
    static long
    zigZagDecode64(long value)
    static int
    zigZagEncode32(int value)
    Zig-zag encode a 32-bit value so that small magnitudes map to small varints.
    static long
    zigZagEncode64(long value)
    Zig-zag encode a 64-bit value so that small magnitudes map to small varints.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VARINT

      public static final int VARINT
      Variable-width integer.
      See Also:
    • FIXED64

      public static final int FIXED64
      Fixed eight-byte value.
      See Also:
    • LENGTH_DELIMITED

      public static final int LENGTH_DELIMITED
      Length-prefixed bytes: strings, byte arrays, nested messages and packed repeated fields.
      See Also:
    • START_GROUP

      public static final int START_GROUP
      Start of a deprecated group value.
      See Also:
    • END_GROUP

      public static final int END_GROUP
      End of a deprecated group value.
      See Also:
    • FIXED32

      public static final int FIXED32
      Fixed 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 number
      wireType - 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)
      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)
      Parameters:
      value - The zig-zag encoded value
      Returns:
      The value