Class: AMF::Pure::AMF3Deserializer

Inherits:
Object
  • Object
show all
Includes:
ReadIOHelpers
Defined in:
lib/amf/pure/deserializer.rb

Overview

AMF3 implementation of deserializer, loaded automatically by the AMF0 deserializer when needed

Instance Method Summary collapse

Methods included from ReadIOHelpers

#byte_order, #byte_order_little?, #read_double, #read_int16_network, #read_int8, #read_word16_network, #read_word32_network, #read_word8

Constructor Details

#initializeAMF3Deserializer

Returns a new instance of AMF3Deserializer.



157
158
159
160
161
# File 'lib/amf/pure/deserializer.rb', line 157

def initialize
  @string_cache = []
  @object_cache = []
  @trait_cache = []
end

Instance Method Details

#deserialize(source, type = nil) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/amf/pure/deserializer.rb', line 163

def deserialize(source, type=nil)
  source = StringIO.new(source) unless StringIO === source
  type = read_int8 source unless type
  case type
    when AMF3_UNDEFINED_MARKER
      nil
    when AMF3_NULL_MARKER
      nil
    when AMF3_FALSE_MARKER
      false
    when AMF3_TRUE_MARKER
      true
    when AMF3_INTEGER_MARKER
      read_integer source
    when AMF3_DOUBLE_MARKER
      read_number source
    when AMF3_STRING_MARKER
      read_string source
    when AMF3_XML_DOC_MARKER
      #read_xml_string
    when AMF3_DATE_MARKER
      read_date source
    when AMF3_ARRAY_MARKER
      read_array source
    when AMF3_OBJECT_MARKER
      read_object source
    when AMF3_XML_MARKER
      #read_amf3_xml
    when AMF3_BYTE_ARRAY_MARKER
      #read_amf3_byte_array
  end
end