Package pyamf :: Module amf3 :: Class Decoder

[hide private]
[frames] | no frames]

# Class Decoder

source code

Decodes an AMF3 data stream.

Nested Classes | [hide private]

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

Instance Methods | [hide private]

__init__(self, data=None, context=None, strict=False, use_proxies=None) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

`int`

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

readUndefined(self) Read undefined. | source code

`None`

readNull(self) Read null. | source code

`bool`

readBoolFalse(self) Returns `False`. | source code

`bool`

readBoolTrue(self) Returns `True`. | source code

readNumber(self) Read number. | source code

readUnsignedInteger(self) Reads and returns an unsigned integer from the stream. | source code

readSignedInteger(self) Reads and returns a signed integer from the stream. | source code

readInteger(self, signed=False) Reads and returns an integer from the stream. | source code

readString(self, use_references=True) Reads and returns a string from the stream. | source code

readDate(self) Read date from the stream. | source code

readArray(self) Reads an array from the stream. | source code

_getClassDefinition(self, ref) Reads class definition from the stream. | source code

readObject(self, _use_proxies=None) Reads an object from the stream. | source code

readProxyObject(self, proxy) Return the source object of a proxied object. | source code

_readXML(self, legacy=False) Reads an object from the stream. | source code

ET

readXMLString(self) Reads a string from the data stream and converts it into an XML Tree. | source code

ET

readXML(self) Read a legacy XML Document from the stream. | source code

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

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

Class Variables | [hide private]

`list` | type_map = ``{`0`:` `'``readUndefined``'``,` 1`:` `'``readNull``'``,` 2`:` `'``readBoolFal``...``

Instance Variables | [hide private]

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

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, data=None, context=None, strict=False, use_proxies=None)
(Constructor)

source code

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  - `data` - Data stream.
  - `context` - Context.
Raises:
  - `TypeError` - The `context` parameter must be of type Context.
Overrides: object.__init__
  (inherited documentation)

### readType(self)

source code

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

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

### readNull(self)

source code

Read null.

Returns: `None`
  `None`

### readBoolFalse(self)

source code

Returns `False`.

Returns: `bool`
  `False`

### readBoolTrue(self)

source code

Returns `True`.

Returns: `bool`
  `True`

### readInteger(self, signed=False)

source code

Reads and returns an integer from the stream.

Parameters:
  - `signed` (`bool`)

See Also: Parsing integers on OSFlash for the AMF3 integer data format.

### readString(self, use_references=True)

source code

Reads and returns a string from the stream.

Parameters:
  - `use_references` (`bool`)

### readDate(self)

source code

Read date from the stream.

The timezone is ignored as the date is always in UTC.

### readArray(self)

source code

Reads an array from the stream.

Warning: There is a very specific problem with AMF3 where the first three bytes of an encoded empty `dict` will mirror that of an encoded `{'': 1, '2': 2}`

See Also: Docuverse blog (external)

### readObject(self, _use_proxies=None)

source code

Reads an object from the stream.

Raises:
  - `pyamf.EncodeError` - Decoding an object in amf3 tagged as amf0 only is not allowed.
  - `pyamf.DecodeError` - Unknown object encoding.

### readProxyObject(self, proxy)

source code

Return the source object of a proxied object.

Since: 0.4

### _readXML(self, legacy=False)

source code

Reads an object from the stream.

Parameters:
  - `legacy` (`bool`) - The read XML is in 'legacy' format.

### readXMLString(self)

source code

Reads a string from the data stream and converts it into an XML Tree.

Returns: ET
  The XML Document.

### readXML(self)

source code

Read a legacy XML Document from the stream.

Returns: ET
  The XML Document.

### readByteArray(self)

source code

Reads a string of data from the stream.

Detects if the ByteArray was compressed using `zlib`.

See Also: ByteArray

Note: This is not supported in ActionScript 1.0 and 2.0.

Class Variable Details | [hide private]

### type_map

Type:
  `list`

Value:

      {0: 'readUndefined',
       1: 'readNull',
       2: 'readBoolFalse',
       3: 'readBoolTrue',
       4: 'readSignedInteger',
       5: 'readNumber',
       6: 'readString',
       7: 'readXML',
      ...