Package org.microproxy.contentviews
Interface ProtoValue
- All Known Implementing Classes:
ProtoValue.Bytes,ProtoValue.Fixed32,ProtoValue.Fixed64,ProtoValue.Group,ProtoValue.Message,ProtoValue.Packed,ProtoValue.Text,ProtoValue.Varint
public sealed interface ProtoValue
permits ProtoValue.Varint, ProtoValue.Fixed32, ProtoValue.Fixed64, ProtoValue.Bytes, ProtoValue.Text, ProtoValue.Message, ProtoValue.Packed, ProtoValue.Group
One value of a protobuf field: what its wire type says, plus how a length-delimited value was
understood. Without a schema,
Protobuf.decode(byte[]) guesses whether length-delimited
bytes are ProtoValue.Text, a nested ProtoValue.Message or plain ProtoValue.Bytes; with one, the declared
field types decide, and repeated scalars sent packed become ProtoValue.Packed.
Every value re-encodes to the wire form it was read from (Protobuf.encode(ProtoMessage)).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordLength-delimited bytes (wire type 2) that are neither text nor a message, or that a schema declares asbytes.static final recordFour bytes (wire type 5):fixed32,sfixed32orfloat.static final recordEight bytes (wire type 1):fixed64,sfixed64ordouble.static final recordA group (wire types 3 and 4), proto2's deprecated way of nesting a message.static final recordA nested message (wire type 2).static final recordA packed repeated scalar field (wire type 2): severalProtoValue.Varint,ProtoValue.Fixed32orProtoValue.Fixed64values in one length-delimited value.static final recordLength-delimited UTF-8 text (wire type 2): astring, or bytes that read as text.static final recordA varint (wire type 0):int32,int64,uint32,uint64,sint32,sint64,boolor an enum. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intWire type 4: the end of a group.static final intWire type 5: four little-endian bytes.static final intWire type 1: eight little-endian bytes.static final intWire type 2: a length, then that many bytes.static final intWire type 3: the start of a group.static final intWire type 0: base-128 varint. -
Method Summary
Modifier and TypeMethodDescriptionintwireType()Returns the wire type this value is encoded with.
-
Field Details
-
WIRE_VARINT
static final int WIRE_VARINTWire type 0: base-128 varint.- See Also:
-
WIRE_FIXED64
static final int WIRE_FIXED64Wire type 1: eight little-endian bytes.- See Also:
-
WIRE_LEN
static final int WIRE_LENWire type 2: a length, then that many bytes.- See Also:
-
WIRE_START_GROUP
static final int WIRE_START_GROUPWire type 3: the start of a group.- See Also:
-
WIRE_END_GROUP
static final int WIRE_END_GROUPWire type 4: the end of a group.- See Also:
-
WIRE_FIXED32
static final int WIRE_FIXED32Wire type 5: four little-endian bytes.- See Also:
-
-
Method Details
-
wireType
int wireType()Returns the wire type this value is encoded with.- Returns:
- the wire type this value is encoded with
-