Zend Framework  1.12
Public Member Functions | Protected Attributes | List of all members
Zend_Amf_Util_BinaryStream Class Reference

Public Member Functions

 __construct ($stream)
 Constructor.
 
 getStream ()
 Returns the current stream.
 
 readBytes ($length)
 Read the number of bytes in a row for the length supplied.
 
 writeBytes ($bytes)
 Write any length of bytes to the stream.
 
 readByte ()
 Reads a signed byte.
 
 writeByte ($stream)
 Writes the passed string into a signed byte on the stream.
 
 readInt ()
 Reads a signed 32-bit integer from the data stream.
 
 writeInt ($stream)
 Write an the integer to the output stream as a 32 bit signed integer.
 
 readUtf ()
 Reads a UTF-8 string from the data stream.
 
 writeUtf ($stream)
 Wite a UTF-8 string to the outputstream.
 
 readLongUtf ()
 Read a long UTF string.
 
 writeLongUtf ($stream)
 Write a long UTF string to the buffer.
 
 readLong ()
 Read a long numeric value.
 
 writeLong ($stream)
 Write long numeric value to output stream.
 
 readUnsignedShort ()
 Read a 16 bit unsigned short.
 
 readDouble ()
 Reads an IEEE 754 double-precision floating point number from the data stream.
 
 writeDouble ($stream)
 Writes an IEEE 754 double-precision floating point number from the data stream.
 

Protected Attributes

 $_stream
 
 $_streamLength
 
 $_bigEndian
 
 $_needle
 
 $_mbStringFunctionsOverloaded
 

Constructor & Destructor Documentation

__construct (   $stream)

Constructor.

Create a reference to a byte stream that is going to be parsed or created by the methods in the class. Detect if the class should use big or little Endian encoding.

Parameters
string$streamuse '' if creating a new stream or pass a string if reading.
Returns
void

Member Function Documentation

getStream ( )

Returns the current stream.

Returns
string
readByte ( )

Reads a signed byte.

Returns
int Value is in the range of -128 to 127.
Exceptions
Zend_Amf_Exception
readBytes (   $length)

Read the number of bytes in a row for the length supplied.

Todo:
Should check that there are enough bytes left in the stream we are about to read.
Parameters
int$length
Returns
string
Exceptions
Zend_Amf_Exceptionfor buffer underrun
readDouble ( )

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

Returns
double Floating point number
readInt ( )

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

Returns
int Value is in the range of -2147483648 to 2147483647
readLong ( )

Read a long numeric value.

Returns
double
readLongUtf ( )

Read a long UTF string.

Returns
string
readUnsignedShort ( )

Read a 16 bit unsigned short.

Todo:
This could use the unpack() w/ S,n, or v
Returns
double
readUtf ( )

Reads a UTF-8 string from the data stream.

Returns
string A UTF-8 string produced by the byte representation of characters
writeByte (   $stream)

Writes the passed string into a signed byte on the stream.

Parameters
string$stream
Returns
Zend_Amf_Util_BinaryStream
writeBytes (   $bytes)

Write any length of bytes to the stream.

Usually a string.

Parameters
string$bytes
Returns
Zend_Amf_Util_BinaryStream
writeDouble (   $stream)

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

Parameters
string | double$stream
Returns
Zend_Amf_Util_BinaryStream
writeInt (   $stream)

Write an the integer to the output stream as a 32 bit signed integer.

Parameters
int$stream
Returns
Zend_Amf_Util_BinaryStream
writeLong (   $stream)

Write long numeric value to output stream.

Parameters
int | string$stream
Returns
Zend_Amf_Util_BinaryStream
writeLongUtf (   $stream)

Write a long UTF string to the buffer.

Parameters
string$stream
Returns
Zend_Amf_Util_BinaryStream
writeUtf (   $stream)

Wite a UTF-8 string to the outputstream.

Parameters
string$stream
Returns
Zend_Amf_Util_BinaryStream

Member Data Documentation

$_bigEndian
protected
$_mbStringFunctionsOverloaded
protected
$_needle
protected
$_stream
protected
$_streamLength
protected