class

Thrift::Protocol::BinaryProtocol

Inherits Thrift::Protocol::BaseProtocol < Reference < Object

BinaryProtocol write values to a transport encoding it as binary data

Constants

TYPE_MASK = 255_u32
VERSION_1 = 2147549184_u32
VERSION_MASK = 4294901760_u32

Constructors

new(trans, strict_read : Bool = true, strict_write : Bool = true, *, byte_format : IO::ByteFormat = IO::ByteFormat::NetworkEndian)
Source

Instance methods

byte_format
Source
read_binary

Reads a Thrift Binary (Thrift String without encoding). In Crystal 1.5.2 and onward, all Strings will be returned with an Encoding of BINARY.

Returns a String.

Source
read_bool
Source
read_byte
Source
read_double
Source
read_field_begin
Source
read_i16
Source
read_i32
Source
read_i64
Source
read_list_begin
Source
read_map_begin
Source
read_message_begin
Source
read_set_begin
Source
read_string

Reads a Thrift String. In Crystal 1.5.2 and onward, all Strings will be returned with an Encoding of UTF-8.

Returns a String.

Source
read_struct_begin
Source
read_uuid
Source
strict_read
Source
strict_write
Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
write_binary(buf : Bytes)

Writes a Thrift Binary (Thrift String with no encoding). In Crystal 1.5.2 and onward

buf - The Bytes to write

Returns nothing.

Source
write_bool(bool)
Source
write_byte(byte : Int8)
Source
write_double(dub : Float64)
Source
write_field_begin(name : String, type : Types, id : Int16)
Source
write_field_stop
Source
write_i16(i16 : Int16)
Source
write_i32(i32 : Int32)
Source
write_i64(i64 : Int64)
Source
write_list_begin(etype, size)
Source
write_map_begin(ktype, vtype, size)
Source
write_message_begin(name : String, type : Thrift::MessageTypes, seqid : Int32)
Source
write_set_begin(etype, size)
Source
write_string(str : String)

Writes a Thrift String. In Crystal 1.5.2 and onward, the String passed will be transcoded to UTF-8.

str - The String to write.

Raises EncodingError if the transcoding to UTF-8 fails.

Returns nothing.

Source
write_struct_begin(name)
Source
write_uuid(uuid : UUID)
Source