struct Crabbit::AMQP::Decoder

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.cr
crabbit/amqp/message_codec.cr

Constant Summary

MAX_CONTAINER_ELEMENTS = 1000000

Maximum number of elements accepted from an AMQP container declaration.

Constructors

Instance Method Summary

Constructor Detail

def self.new(bytes : Bytes, position : Int32 = 0, *, zero_copy : Bool = false) #

Creates a decoder at position in bytes.


[View source]

Instance Method Detail

def bytes : Bytes #

Returns the complete input buffer.


[View source]
def consume_described_descriptor(expected : UInt64) : Nil #

Consumes the next numeric descriptor and validates it against expected.


[View source]
def eof? : Bool #

Returns whether all input bytes have been consumed.


[View source]
def peek_described_descriptor : UInt64 | Nil #

Returns the numeric descriptor of the next described value without consuming input, or nil when it is absent or non-numeric.


[View source]
def position : Int32 #

Returns the next unread byte position.


[View source]
def read : Value #

Reads and returns one complete AMQP value.


[View source]
def read_binary : Bytes #

Reads one AMQP binary value.


[View source]
def read_list_values : Array(Value) #

Reads one AMQP list and returns its element values.


[View source]
def read_map_values : Hash(Value, Value) #

Reads one AMQP map and returns its entries.


[View source]
def remaining : Int32 #

Returns the number of unread input bytes.


[View source]