struct
Proto::Wire::Reader
- Proto::Wire::Reader
- Struct
- Value
- Object
Overview
Reader wraps an IO and provides typed protobuf wire-format read primitives.
Entry point for message decode loops is #read_tag, which returns nil on
clean EOF (end of message) and raises DecodeError on malformed input.
All other read methods raise DecodeError on unexpected EOF.
Defined in:
proto/wire/reader.crConstant Summary
-
DEFAULT_MAX_FIELD_LENGTH =
(8 * 1024) * 1024 -
DEFAULT_MAX_MESSAGE_SIZE =
(64_i64 * 1024) * 1024 -
MAX_FIELD_NUMBER =
536870911
Constructors
Class Method Summary
Instance Method Summary
- #expect_wire_type!(field_number : Int32, wire_type : Int32, expected_wire_type : Int32, alternate_wire_type : Int32) : Nil
- #expect_wire_type!(field_number : Int32, wire_type : Int32, expected_wire_type : Int32) : Nil
- #packed_wire_type?(field_number : Int32, wire_type : Int32, unpacked_wire_type : Int32) : Bool
- #read_bool : Bool
- #read_bytes : Bytes
- #read_double : Float64
-
#read_embedded : IO::Memory
Return a scoped IO::Memory over the next length-delimited field.
- #read_embedded(field_number : Int32, wire_type : Int32, & : IO::Memory -> T) : T forall T
- #read_fixed32 : UInt32
- #read_fixed64 : UInt64
- #read_float : Float32
-
#read_int32 : Int32
int32 / int64 use sign-extended varint
- #read_int64 : Int64
-
#read_packed_double(& : Float64 -> ) : Nil
Decode a packed repeated double field.
-
#read_packed_fixed32(& : UInt32 -> ) : Nil
Decode a packed repeated fixed32 field.
-
#read_packed_fixed64(& : UInt64 -> ) : Nil
Decode a packed repeated fixed64 field.
-
#read_packed_float(& : Float32 -> ) : Nil
Decode a packed repeated float field.
-
#read_packed_sfixed32(& : Int32 -> ) : Nil
Decode a packed repeated sfixed32 field.
-
#read_packed_sfixed64(& : Int64 -> ) : Nil
Decode a packed repeated sfixed64 field.
-
#read_packed_varint(& : UInt64 -> ) : Nil
Decode a packed repeated varint field into the given array.
- #read_sfixed32 : Int32
- #read_sfixed64 : Int64
-
#read_sint32 : Int32
sint32 / sint64 use zigzag encoding
- #read_sint64 : Int64
- #read_string : String
-
#read_tag : Tuple(Int32, Int32) | Nil
Read the next field tag.
-
#read_uint32 : UInt32
uint32 / uint64 use plain varint
- #read_uint64 : UInt64
- #read_unknown_field(field_number : Int32, wire_type : Int32) : UnknownField
-
#skip_field(wire_type : Int32) : Nil
Skip one untagged field value of the given wire type.
-
#skip_tag(tag : Tuple(Int32, Int32)) : Nil
Skip one tagged field value with strict START_GROUP/END_GROUP matching.
Constructor Detail
Class Method Detail
Instance Method Detail
Return a scoped IO::Memory over the next length-delimited field. The bytes are consumed from this reader immediately.
Decode a packed repeated varint field into the given array. Yields each decoded UInt64 raw value; callers convert as needed.
Read the next field tag. Returns {field_number, wire_type}, or nil on clean EOF.
Skip one tagged field value with strict START_GROUP/END_GROUP matching.