Method: Kafka::Protocol::Encoder#write_string

Defined in:
lib/kafka/protocol/encoder.rb

#write_string(string) ⇒ nil

Writes a string to the IO object.

Parameters:

  • string (String)

Returns:

  • (nil)


104
105
106
107
108
109
110
111
# File 'lib/kafka/protocol/encoder.rb', line 104

def write_string(string)
  if string.nil?
    write_int16(-1)
  else
    write_int16(string.bytesize)
    write(string)
  end
end