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

Class Encoder

source code


Encodes an AMF0 stream.

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
buildContext(self)
A context factory.
source code
 
getTypeFunc(self, data)
Returns a callable that will encode data to self.stream.
source code
 
writeType(self, t)
Writes the type to the stream.
source code
 
writeUndefined(self, data)
Writes the undefined data type to the stream.
source code
 
writeNull(self, n)
Write null type to data stream.
source code
 
writeList(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
 
serialiseString(self, s)
Similar to writeString but does not encode a type byte.
source code
 
writeBytes(self, s)
Write a string of bytes to the data stream.
source code
 
writeString(self, u)
Write a unicode 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
 
writeObject(self, o)
Write a Python object to the stream.
source code
 
writeDate(self, d)
Writes a date to the data stream.
source code
 
writeXML(self, e)
Writes an XML instance.
source code
 
writeAMF3(self, data)
Writes an element in AMF3 format.
source code

Inherited from codec.Encoder: __iter__, next, send, writeElement, writeGenerator, writeSequence

Inherited from codec.Encoder (private): _write_type

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

Instance Variables [hide private]
bool use_amf3
A flag to determine whether this encoder should default to using AMF3.

Inherited from codec._Codec: context, stream, strict, timezone_offset

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

buildContext(self)

source code 

A context factory.

Overrides: codec._Codec.buildContext
(inherited documentation)

getTypeFunc(self, data)

source code 

Returns a callable that will encode data to self.stream. If data is unencodable, then None is returned.

Overrides: codec._Codec.getTypeFunc
(inherited documentation)

writeType(self, t)

source code 

Writes the type to the stream.

Parameters:
  • t (str) - ActionScript type.

writeUndefined(self, data)

source code 

Writes the undefined data type to the stream.

Parameters:
  • data - Ignored, here for the sake of interface.
Overrides: codec.Encoder._write_type

writeNull(self, n)

source code 

Write null type to data stream.

Overrides: codec.Encoder._write_type

writeList(self, a)

source code 

Write array to the stream.

Parameters:
  • a - The array data to be encoded to the AMF0 data stream.
Overrides: codec.Encoder._write_type

writeNumber(self, n)

source code 

Write number to the data stream .

Parameters:
  • n - The number data to be encoded to the AMF0 data stream.
Overrides: codec.Encoder._write_type

writeBoolean(self, b)

source code 

Write boolean to the data stream.

Parameters:
  • b - The boolean data to be encoded to the AMF0 data stream.
Overrides: codec.Encoder._write_type

writeBytes(self, s)

source code 

Write a string of bytes to the data stream.

Overrides: codec.Encoder._write_type

writeString(self, u)

source code 

Write a unicode to the data stream.

Overrides: codec.Encoder._write_type

writeReference(self, o)

source code 

Write reference to the data stream.

Parameters:
  • o - The reference data to be encoded to the AMF0 datastream.

_writeDict(self, o)

source code 

Write dict to the data stream.

Parameters:
  • o - The dict data to be encoded to the AMF0 data stream.

writeMixedArray(self, o)

source code 

Write mixed array to the data stream.

Parameters:

writeObject(self, o)

source code 

Write a Python object to the stream.

Parameters:
  • o - The object data to be encoded to the AMF0 data stream.
Overrides: codec.Encoder._write_type

writeDate(self, d)

source code 

Writes a date to the data stream.

Parameters:
  • d (Instance of datetime.datetime) - The date to be encoded to the AMF0 data stream.
Overrides: codec.Encoder._write_type

writeXML(self, e)

source code 

Writes an XML instance.

Overrides: codec.Encoder._write_type

Instance Variable Details [hide private]

use_amf3

A flag to determine whether this encoder should default to using AMF3. Defaults to False
Type:
bool