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

package Zend_Amf
subpackage Util
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Constructor

__construct(string $stream) : void

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

$stream

string

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

Returns the current stream

getStream() : string

Returns

string

Reads a signed byte

readByte() : integer

Exceptions

\Zend_Amf_Exception

Returns

integerValue is in the range of -128 to 127.

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

readBytes(integer $length) : string
todo Should check that there are enough bytes left in the stream we are about to read.

Parameters

$length

integer

Exceptions

\Zend_Amf_Exception for buffer underrun

Returns

string

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

readDouble() : double

Returns

doubleFloating point number

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

readInt() : integer

Returns

integerValue is in the range of -2147483648 to 2147483647

Read a long numeric value

readLong() : double

Returns

double

Read a long UTF string

readLongUtf() : string

Returns

string

Read a 16 bit unsigned short.

readUnsignedShort() : double
todo This could use the unpack() w/ S,n, or v

Returns

double

Reads a UTF-8 string from the data stream

readUtf() : string

Returns

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

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

writeByte(string $stream) : \Zend_Amf_Util_BinaryStream

Parameters

$stream

string

Returns

\Zend_Amf_Util_BinaryStream

Write any length of bytes to the stream

writeBytes(string $bytes) : \Zend_Amf_Util_BinaryStream

Usually a string.

Parameters

$bytes

string

Returns

\Zend_Amf_Util_BinaryStream

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

writeDouble(string|double $stream) : \Zend_Amf_Util_BinaryStream

Parameters

$stream

stringdouble

Returns

\Zend_Amf_Util_BinaryStream

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

writeInt(integer $stream) : \Zend_Amf_Util_BinaryStream

Parameters

$stream

integer

Returns

\Zend_Amf_Util_BinaryStream

Write long numeric value to output stream

writeLong(integer|string $stream) : \Zend_Amf_Util_BinaryStream

Parameters

$stream

integerstring

Returns

\Zend_Amf_Util_BinaryStream

Write a long UTF string to the buffer

writeLongUtf(string $stream) : \Zend_Amf_Util_BinaryStream

Parameters

$stream

string

Returns

\Zend_Amf_Util_BinaryStream

Wite a UTF-8 string to the outputstream

writeUtf(string $stream) : \Zend_Amf_Util_BinaryStream

Parameters

$stream

string

Returns

\Zend_Amf_Util_BinaryStream

 Properties

 

BigEndian encoding?

$_bigEndian : boolean

Default

 

str* functions overloaded using mbstring.func_overload?

$_mbStringFunctionsOverloaded : boolean

Default

 

Current position in stream

$_needle : integer

Default

 

Byte stream

$_stream : string

Default

 

Length of stream

$_streamLength : integer

Default