Module: AMF
- Includes:
- Pure
- Defined in:
- lib/amf.rb,
lib/amf/pure.rb,
lib/amf/version.rb,
lib/amf/messages.rb,
lib/amf/constants.rb,
lib/amf/active_record.rb,
lib/amf/class_mapping.rb,
lib/amf/pure/remoting.rb,
lib/amf/pure/io_helpers.rb,
lib/amf/pure/serializer.rb,
lib/amf/pure/deserializer.rb
Defined Under Namespace
Modules: ActiveRecord, Messages, Pure, Serialization Classes: AMFError, ClassMapping
Constant Summary collapse
- ClassMapper =
AMF::ClassMapping.new
- VERSION =
AMF version
'0.0.1'- VERSION_ARRAY =
:nodoc:
VERSION.split(/\./).map { |x| x.to_i }
- VERSION_MAJOR =
:nodoc:
VERSION_ARRAY[0]
- VERSION_MINOR =
:nodoc:
VERSION_ARRAY[1]
- VERSION_BUILD =
:nodoc:
VERSION_ARRAY[2]
- VARIANT_BINARY =
false- AMF0_NUMBER_MARKER =
AMF0 Type Markers
0x00- AMF0_BOOLEAN_MARKER =
“000”
0x01- AMF0_STRING_MARKER =
“001”
0x02- AMF0_OBJECT_MARKER =
“002”
0x03- AMF0_MOVIE_CLIP_MARKER =
“003”
0x04- AMF0_NULL_MARKER =
“004” # Unused
0x05- AMF0_UNDEFINED_MARKER =
“005”
0x06- AMF0_REFERENCE_MARKER =
“006”
0x07- AMF0_HASH_MARKER =
“a”
0x08- AMF0_OBJECT_END_MARKER =
“b”
0x09- AMF0_STRICT_ARRAY_MARKER =
“t”
0x0A
- AMF0_DATE_MARKER =
“n”
0x0B
- AMF0_LONG_STRING_MARKER =
“v”
0x0C
- AMF0_UNSUPPORTED_MARKER =
“f”
0x0D
- AMF0_RECORDSET_MARKER =
“r”
0x0E
- AMF0_XML_MARKER =
“016” # Unused
0x0F
- AMF0_TYPED_OBJECT_MARKER =
“017”
0x10- AMF0_AMF3_MARKER =
“020”
0x11- AMF3_UNDEFINED_MARKER =
AMF3 Type Markers
0x00- AMF3_NULL_MARKER =
“000”
0x01- AMF3_FALSE_MARKER =
“001”
0x02- AMF3_TRUE_MARKER =
“002”
0x03- AMF3_INTEGER_MARKER =
“003”
0x04- AMF3_DOUBLE_MARKER =
“004”
0x05- AMF3_STRING_MARKER =
“005”
0x06- AMF3_XML_DOC_MARKER =
“006”
0x07- AMF3_DATE_MARKER =
“a”
0x08- AMF3_ARRAY_MARKER =
“b”
0x09- AMF3_OBJECT_MARKER =
“t”
0x0A
- AMF3_XML_MARKER =
“n”
0x0B
- AMF3_BYTE_ARRAY_MARKER =
“v”
0x0C
- AMF3_EMPTY_STRING =
Other AMF3 Markers
0x01- AMF3_ANONYMOUS_OBJECT =
0x01- AMF3_DYNAMIC_OBJECT =
0x0B
- AMF3_CLOSE_DYNAMIC_OBJECT =
0x01- AMF3_CLOSE_DYNAMIC_ARRAY =
0x01- MAX_INTEGER =
Other Constants
268435455- MIN_INTEGER =
-268435456
Class Method Summary collapse
-
.deserialize(source, options = {}) ⇒ Object
Deserialize the AMF string source into a Ruby data structure and return it.
-
.serialize(obj, options = {}, &block) ⇒ Object
Serialize the given Ruby data structure obj into an AMF stream.
Class Method Details
.deserialize(source, options = {}) ⇒ Object
Deserialize the AMF string source into a Ruby data structure and return it.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/amf.rb', line 19 def deserialize(source, = {}) [:amf_version] ||= 0 if [:amf_version] == 0 AMF::AMF0Deserializer.new.deserialize(source) elsif [:amf_version] == 3 AMF::AMF3Deserializer.new.deserialize(source) else raise AMFError, "unsupported version #{amf_version}" end end |
.serialize(obj, options = {}, &block) ⇒ Object
Serialize the given Ruby data structure obj into an AMF stream
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/amf.rb', line 31 def serialize(obj, = {}, &block) [:amf_version] ||= 3 if [:amf_version] == 0 AMF::AMF0Serializer.new().serialize(obj, &block) elsif [:amf_version] == 3 AMF::AMF3Serializer.new().serialize(obj, &block) else raise AMFError, "unsupported version #{amf_version}" end end |