Package pyamf :: Module amf0 :: Class Encoder
[hide private]
[frames] | no frames]

Class Encoder

source code


Encodes an AMF0 stream.

Nested Classes [hide private]
type or types.ClassType context_class
Holds the class that will create context objects for the implementing Encoder.
Instance Methods [hide private]
 
writeType(self, type)
Writes the type to the stream.
source code
 
writeUndefined(self, data)
Writes the undefined data type to the stream.
source code
 
writeUnsupported(self, data)
Writes unsupported data type to the stream.
source code
callable or None.
_writeElementFunc(self, data)
Gets a function based on the type of data.
source code
 
writeElement(self, data)
Writes the data.
source code
 
writeNull(self, n)
Write null type to data stream.
source code
 
writeArray(self, a)
Write array to the stream.
source code
 
writeNumber(self, n)
Write number to the data stream.
source code
 
writeBoolean(self, b)
Write boolean to the data stream.
source code
 
_writeString(self, s) source code
 
writeString(self, s, writeType=True)
Write string to the data stream.
source code
 
writeReference(self, o)
Write reference to the data stream.
source code
 
_writeDict(self, o)
Write dict to the data stream.
source code
 
writeMixedArray(self, o)
Write mixed array to the data stream.
source code
 
_writeEndObject(self) source code
 
_getObjectAttrs(self, o, alias) source code
 
writeObject(self, o)
Write object to the stream.
source code
 
writeDate(self, d)
Writes a date to the data stream.
source code
 
writeXML(self, e)
Write XML to the data stream.
source code
 
writeAMF3(self, data)
Writes an element to the datastream in AMF3 format.
source code

Inherited from BaseEncoder: __init__

Inherited from BaseEncoder (private): _getWriteElementFunc

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
list type_map = [((<type 'builtin_function_or_method'>, <type 'buil...
A list of types -> functions.
Instance Variables [hide private]

Inherited from BaseEncoder: context, stream

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

writeType(self, type)

source code 

Writes the type to the stream.

Parameters:
  • type (int) - ActionScript type.
Raises:

_writeElementFunc(self, data)

source code 

Gets a function based on the type of data.

Parameters:
  • data - Python data.
Returns: callable or None.
The function used to encode data to the stream.
Overrides: BaseEncoder._writeElementFunc

writeElement(self, data)

source code 

Writes the data.

Parameters:
  • data (mixed) - The data to be encoded to the AMF0 data stream.
Raises:
Overrides: BaseEncoder.writeElement

writeNull(self, n)

source code 

Write null type to data stream.

Parameters:
  • n (None) - Is ignored.

writeArray(self, a)

source code 

Write array to the stream.

Parameters:

writeNumber(self, n)

source code 

Write number to the data stream.

Parameters:

writeBoolean(self, b)

source code 

Write boolean to the data stream.

Parameters:

writeString(self, s, writeType=True)

source code 

Write string to the data stream.

Parameters:

writeReference(self, o)

source code 

Write reference to the data stream.

Parameters:

_writeDict(self, o)

source code 

Write dict to the data stream.

Parameters:
  • o (iterable) - AMF data.

writeMixedArray(self, o)

source code 

Write mixed array to the data stream.

Parameters:

writeObject(self, o)

source code 

Write object to the stream.

Parameters:

writeDate(self, d)

source code 

Writes a date to the data stream.

Parameters:
  • d (Instance of datetime.datetime) - The date to be written.

writeXML(self, e)

source code 

Write XML to the data stream.

Parameters:

writeAMF3(self, data)

source code 

Writes an element to the datastream in AMF3 format.

Parameters:
  • data (mixed) - The data to be encoded.

Class Variable Details [hide private]

type_map

A list of types -> functions. The types is a list of possible instances or functions to call (that return a bool) to determine the correct function to call to encode the data.
Type:
list
Value:
[((<type 'builtin_function_or_method'>,
   <type 'builtin_function_or_method'>),
  'writeUnsupported'),
 ((<type 'NoneType'>), 'writeNull'),
 ((<type 'bool'>), 'writeBoolean'),
 ((<type 'int'>, <type 'long'>, <type 'float'>), 'writeNumber'),
 (((<type 'str'>, <type 'unicode'>)), 'writeString'),
 ((<function has_alias at 0xb11a28>, <class 'pyamf.ASObject'>), 'write\
...