Package pyamf :: Module amf3 :: Class DataOutput

[hide private]
[frames] | no frames]

# Class DataOutput

source code

I am a `StringIO` type object containing byte data from the AMF stream. ActionScript 3.0 introduced the `flash.utils.ByteArray` class to support the manipulation of raw data in the form of an Array of bytes. I provide a set of methods for writing binary data with ActionScript 3.0.

This class is the I/O counterpart to the DataInput class, which reads binary data.

See Also: IDataOutput on Livedocs (external)

Instance Methods | [hide private]

__init__(self, encoder) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code

writeBoolean(self, value) Writes a Boolean value. | source code

writeByte(self, value) Writes a byte. | source code

writeDouble(self, value) Writes an IEEE 754 double-precision (64-bit) floating point number. | source code

writeFloat(self, value) Writes an IEEE 754 single-precision (32-bit) floating point number. | source code

writeInt(self, value) Writes a 32-bit signed integer. | source code

writeMultiByte(self, value, charset) Writes a multibyte string to the datastream using the specified character set. | source code

writeObject(self, value, use_references=True) Writes an object to data stream in AMF serialized format. | source code

writeShort(self, value) Writes a 16-bit integer. | source code

writeUnsignedInt(self, value) Writes a 32-bit unsigned integer. | source code

writeUTF(self, value) Writes a UTF-8 string to the data stream. | source code

writeUTFBytes(self, value) Writes a UTF-8 string. | source code

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

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, encoder)
(Constructor)

source code

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

Parameters:
  - `encoder` (amf3.Encoder) - Encoder containing the stream.
Overrides: object.__init__

### writeBoolean(self, value)

source code

Writes a Boolean value.

Parameters:
  - `value` (`bool`) - A `Boolean` value determining which byte is written. If the parameter is `True`, `1` is written; if `False`, `0` is written.
Raises:
  - `ValueError` - Non-boolean value found.

### writeByte(self, value)

source code

Writes a byte.

Parameters:
  - `value` (`int`)

### writeDouble(self, value)

source code

Writes an IEEE 754 double-precision (64-bit) floating point number.

Parameters:
  - `value` (`number`)

### writeFloat(self, value)

source code

Writes an IEEE 754 single-precision (32-bit) floating point number.

Parameters:
  - `value` (`float`)

### writeInt(self, value)

source code

Writes a 32-bit signed integer.

Parameters:
  - `value` (`int`)

### writeMultiByte(self, value, charset)

source code

Writes a multibyte string to the datastream using the specified character set.

Parameters:
  - `value` (`str`) - The string value to be written.
  - `charset` (`str`) - The string denoting the character set to use. Possible character set strings include `shift-jis`, `cn-gb`, `iso-8859-1` and others.

See Also: Supported character sets on Livedocs (external)

### writeObject(self, value, use_references=True)

source code

Writes an object to data stream in AMF serialized format.

Parameters:
  - `value` - The object to be serialized.
  - `use_references` (`bool`)

### writeShort(self, value)

source code

Writes a 16-bit integer.

Parameters:
  - `value` (`int`) - A byte value as an integer.

### writeUnsignedInt(self, value)

source code

Writes a 32-bit unsigned integer.

Parameters:
  - `value` (`int`) - A byte value as an unsigned integer.

### writeUTF(self, value)

source code

Writes a UTF-8 string to the data stream.

The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string.

Parameters:
  - `value` (`str`) - The string value to be written.

### writeUTFBytes(self, value)

source code

Writes a UTF-8 string. Similar to writeUTF, but does not prefix the string with a 16-bit length word.

Parameters:
  - `value` (`str`) - The string value to be written.