struct
Crabbit::AMQP::Decoder
- Crabbit::AMQP::Decoder
- Struct
- Value
- Object
Overview
Bounds-checked decoder for generic AMQP 1.0 values.
Decoding copies binary values by default. With zero_copy, returned binary slices reference the input buffer; callers must keep it alive and immutable.
Defined in:
crabbit/amqp/codec.crcrabbit/amqp/message_codec.cr
Constant Summary
-
MAX_CONTAINER_ELEMENTS =
1000000 -
Maximum number of elements accepted from an AMQP container declaration.
Constructors
-
.new(bytes : Bytes, position : Int32 = 0, *, zero_copy : Bool = false)
Creates a decoder at position in bytes.
Instance Method Summary
-
#bytes : Bytes
Returns the complete input buffer.
-
#consume_described_descriptor(expected : UInt64) : Nil
Consumes the next numeric descriptor and validates it against expected.
-
#eof? : Bool
Returns whether all input bytes have been consumed.
-
#peek_described_descriptor : UInt64 | Nil
Returns the numeric descriptor of the next described value without consuming input, or
nilwhen it is absent or non-numeric. -
#position : Int32
Returns the next unread byte position.
-
#read : Value
Reads and returns one complete AMQP value.
-
#read_binary : Bytes
Reads one AMQP binary value.
-
#read_list_values : Array(Value)
Reads one AMQP list and returns its element values.
-
#read_map_values : Hash(Value, Value)
Reads one AMQP map and returns its entries.
-
#remaining : Int32
Returns the number of unread input bytes.
Constructor Detail
Creates a decoder at position in bytes.
Instance Method Detail
Consumes the next numeric descriptor and validates it against expected.
Returns the numeric descriptor of the next described value without
consuming input, or nil when it is absent or non-numeric.
Reads one AMQP list and returns its element values.
Reads one AMQP map and returns its entries.