Method: Codec::Prefixedlength#encode

Defined in:
lib/codec/prefix.rb

#encode(buf, field) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/codec/prefix.rb', line 30

def encode(buf, field)
  out = ""
  content_buf = ""
  len = @value_codec.encode(content_buf, field)
  @length_codec.encode(out, Field.new.set_value(len))
  out << content_buf
  buf << out
  return out.length
end