Method: AMF::Pure::AMF3Serializer#write_utf8_vr

Defined in:
lib/amf/pure/serializer.rb

#write_utf8_vr(str) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/amf/pure/serializer.rb', line 173

def write_utf8_vr(str)
  if str == ''
    @stream << AMF3_EMPTY_STRING
  elsif @string_cache[str] != nil
    write_reference(@string_cache[str])
  else
    # Cache string
    @string_cache.add_obj(str)

    # Build AMF string
    header = str.length << 1 # make room for a low bit of 1
    header = header | 1 # set the low bit to 1
    @stream << pack_integer(header)
    @stream << str
  end
end