Package pyamf :: Module amf3 :: Class DataInput
[hide private]
[frames] | no frames]

Class DataInput

source code


I provide a set of methods for reading binary data with ActionScript 3.0.

This class is the I/O counterpart to the DataOutput class, which writes binary data.


See Also: IDataInput on Livedocs (external)

Instance Methods [hide private]
 
__init__(self, decoder=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
bool
readBoolean(self)
Read Boolean.
source code
int
readByte(self)
Reads a signed byte.
source code
number
readDouble(self)
Reads an IEEE 754 double-precision floating point number from the data stream.
source code
number
readFloat(self)
Reads an IEEE 754 single-precision floating point number from the data stream.
source code
int
readInt(self)
Reads a signed 32-bit integer from the data stream.
source code
str
readMultiByte(self, length, charset)
Reads a multibyte string of specified length from the data stream using the specified character set.
source code
 
readObject(self)
Reads an object from the data stream.
source code
uint
readShort(self)
Reads a signed 16-bit integer from the data stream.
source code
uint
readUnsignedByte(self)
Reads an unsigned byte from the data stream.
source code
uint
readUnsignedInt(self)
Reads an unsigned 32-bit integer from the data stream.
source code
uint
readUnsignedShort(self)
Reads an unsigned 16-bit integer from the data stream.
source code
str
readUTF(self)
Reads a UTF-8 string from the data stream.
source code
str
readUTFBytes(self, length)
Reads a sequence of length UTF-8 bytes from the data stream and returns a string.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, decoder=None)
(Constructor)

source code 

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

Parameters:
  • decoder (amf3.Decoder) - AMF3 decoder containing the stream.
Overrides: object.__init__

readBoolean(self)

source code 

Read Boolean.

Returns: bool
A Boolean value, True if the byte is nonzero, False otherwise.
Raises:
  • ValueError - Error reading Boolean.

readByte(self)

source code 

Reads a signed byte.

Returns: int
The returned value is in the range -128 to 127.

readDouble(self)

source code 

Reads an IEEE 754 double-precision floating point number from the data stream.

Returns: number
An IEEE 754 double-precision floating point number.

readFloat(self)

source code 

Reads an IEEE 754 single-precision floating point number from the data stream.

Returns: number
An IEEE 754 single-precision floating point number.

readInt(self)

source code 

Reads a signed 32-bit integer from the data stream.

Returns: int
The returned value is in the range -2147483648 to 2147483647.

readMultiByte(self, length, charset)

source code 

Reads a multibyte string of specified length from the data stream using the specified character set.

Parameters:
  • length (int) - The number of bytes from the data stream to read.
  • charset (str) - The string denoting the character set to use.
Returns: str
UTF-8 encoded string.

readObject(self)

source code 

Reads an object from the data stream.

Returns:
The deserialized object.

readShort(self)

source code 

Reads a signed 16-bit integer from the data stream.

Returns: uint
The returned value is in the range -32768 to 32767.

readUnsignedByte(self)

source code 

Reads an unsigned byte from the data stream.

Returns: uint
The returned value is in the range 0 to 255.

readUnsignedInt(self)

source code 

Reads an unsigned 32-bit integer from the data stream.

Returns: uint
The returned value is in the range 0 to 4294967295.

readUnsignedShort(self)

source code 

Reads an unsigned 16-bit integer from the data stream.

Returns: uint
The returned value is in the range 0 to 65535.

readUTF(self)

source code 

Reads a UTF-8 string from the data stream.

The string is assumed to be prefixed with an unsigned short indicating the length in bytes.

Returns: str
A UTF-8 string produced by the byte representation of characters.

readUTFBytes(self, length)

source code 

Reads a sequence of length UTF-8 bytes from the data stream and returns a string.

Parameters:
  • length (int) - The number of bytes from the data stream to read.
Returns: str
A UTF-8 string produced by the byte representation of characters of specified length.