\Zend_Amf_Util_BinaryStream

Utility class to walk through a data stream byte by byte with conventional names

Summary

Methods
Properties
Constants
__construct()
getStream()
readBytes()
writeBytes()
readByte()
writeByte()
readInt()
writeInt()
readUtf()
writeUtf()
readLongUtf()
writeLongUtf()
readLong()
writeLong()
readUnsignedShort()
readDouble()
writeDouble()
No public properties found
No constants found
No protected methods found
$_stream
$_streamLength
$_bigEndian
$_needle
N/A
No private methods found
No private properties found
N/A

Properties

$_stream

$_stream : string

Type

string — Byte stream

$_streamLength

$_streamLength : integer

Type

integer — Length of stream

$_bigEndian

$_bigEndian : boolean

Type

boolean — BigEndian encoding?

$_needle

$_needle : integer

Type

integer — Current position in stream

Methods

__construct()

__construct(string  $stream) : void

Constructor

Create a refrence 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 $stream

use '' if creating a new stream or pass a string if reading.

getStream()

getStream() : string

Returns the current stream

Returns

string

readBytes()

readBytes(integer  $length) : string

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

Parameters

integer $length

Throws

\Zend_Amf_Exception

for buffer underrun

Returns

string

writeBytes()

writeBytes(string  $bytes) : \Zend_Amf_Util_BinaryStream

Write any length of bytes to the stream

Usually a string.

Parameters

string $bytes

Returns

\Zend_Amf_Util_BinaryStream

readByte()

readByte() : integer

Reads a signed byte

Returns

integer —

Value is in the range of -128 to 127.

writeByte()

writeByte(string  $stream) : \Zend_Amf_Util_BinaryStream

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

Parameters

string $stream

Returns

\Zend_Amf_Util_BinaryStream

readInt()

readInt() : integer

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

Returns

integer —

Value is in the range of -2147483648 to 2147483647

writeInt()

writeInt(integer  $stream) : \Zend_Amf_Util_BinaryStream

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

Parameters

integer $stream

Returns

\Zend_Amf_Util_BinaryStream

readUtf()

readUtf() : string

Reads a UTF-8 string from the data stream

Returns

string —

A UTF-8 string produced by the byte representation of characters

writeUtf()

writeUtf(string  $stream) : \Zend_Amf_Util_BinaryStream

Wite a UTF-8 string to the outputstream

Parameters

string $stream

Returns

\Zend_Amf_Util_BinaryStream

readLongUtf()

readLongUtf() : string

Read a long UTF string

Returns

string

writeLongUtf()

writeLongUtf(string  $stream) : \Zend_Amf_Util_BinaryStream

Write a long UTF string to the buffer

Parameters

string $stream

Returns

\Zend_Amf_Util_BinaryStream

readLong()

readLong() : double

Read a long numeric value

Returns

double

writeLong()

writeLong(integer|string  $stream) : \Zend_Amf_Util_BinaryStream

Write long numeric value to output stream

Parameters

integer|string $stream

Returns

\Zend_Amf_Util_BinaryStream

readUnsignedShort()

readUnsignedShort() : double

Read a 16 bit unsigned short.

Returns

double

readDouble()

readDouble() : double

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

Returns

double —

Floating point number

writeDouble()

writeDouble(string|double  $stream) : \Zend_Amf_Util_BinaryStream

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

Parameters

string|double $stream

Returns

\Zend_Amf_Util_BinaryStream