Package pyamf :: Module amf0 :: Class Decoder

[hide private]
[frames] | no frames]

# Class Decoder

source code

Decodes an AMF0 stream.

Nested Classes | [hide private]

An instance of `BaseDecoder.context_class` | context_class The context for the decoding.

Instance Methods | [hide private]

readType(self) Read and returns the next byte in the stream and determine its type. | source code

`int` or `float`

readNumber(self) Reads a ActionScript `Number` value. | source code

`bool`

readBoolean(self) Reads a ActionScript `Boolean` value. | source code

`None`

readNull(self) Reads a ActionScript `null` value. | source code

readUndefined(self) Reads an ActionScript `undefined` value. | source code

`dict`

readMixedArray(self) Read mixed array. | source code

`list`

readList(self) Read a `list` from the data stream. | source code

readTypedObject(self) Reads an ActionScript object from the stream and attempts to 'cast' it. | source code

`mixed`

readAMF3(self) Read AMF3 elements from the data stream. | source code

`str`

readString(self) Reads a string from the data stream. | source code

_readObject(self, obj, alias=None) | source code

ASObject

readObject(self) Reads an object from the data stream. | source code

readReference(self) Reads a reference from the data stream. | source code

readDate(self) Reads a UTC date from the data stream. | source code

readLongString(self) Read UTF8 string. | source code

readXML(self) Read XML. | source code

Inherited from `BaseDecoder`: `__init__`, `__iter__`, `readElement` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]

`list` | type_map = ``{`0`:` `'``readNumber``'``,` 1`:` `'``readBoolean``'``,` 2`:` `'``readString``'``...``

Instance Variables | [hide private]

Inherited from `BaseDecoder`: `stream`, `strict`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### readType(self)

source code

Read and returns the next byte in the stream and determine its type.

Returns:
  AMF0 type.
Raises:
  - `DecodeError` - AMF0 type not recognized.
Overrides: BaseDecoder.readType

### readNumber(self)

source code

Reads a ActionScript `Number` value.

In ActionScript 1 and 2 the `NumberASTypes` type represents all numbers, both floats and integers.

Returns: `int` or `float`

### readBoolean(self)

source code

Reads a ActionScript `Boolean` value.

Returns: `bool`
  Boolean.

### readNull(self)

source code

Reads a ActionScript `null` value.

Returns: `None`
  `None`

### readUndefined(self)

source code

Reads an ActionScript `undefined` value.

Returns:
  Undefined

### readMixedArray(self)

source code

Read mixed array.

Returns: `dict`
  `dict` read from the stream

### readList(self)

source code

Read a `list` from the data stream.

Returns: `list`
  `list`

### readTypedObject(self)

source code

Reads an ActionScript object from the stream and attempts to 'cast' it.

See Also: load_class

### readAMF3(self)

source code

Read AMF3 elements from the data stream.

Returns: `mixed`
  The AMF3 element read from the stream

### readString(self)

source code

Reads a string from the data stream.

Returns: `str`
  string

### readDate(self)

source code

Reads a UTC date from the data stream. Client and servers are responsible for applying their own timezones.

Date: `0x0B T7 T6` .. `T0 Z1 Z2 T7` to `T0` form a 64 bit Big Endian number that specifies the number of nanoseconds that have passed since 1/1/1970 0:00 to the specified time. This format is UTC 1970. `Z1` and `Z0` for a 16 bit Big Endian number indicating the indicated time's timezone in minutes.

Class Variable Details | [hide private]

### type_map

Type:
  `list`

Value:

      {0: 'readNumber',
       1: 'readBoolean',
       2: 'readString',
       3: 'readObject',
       5: 'readNull',
       6: 'readUndefined',
       7: 'readReference',
       8: 'readMixedArray',
      ...