Amf/Util/BinaryStream.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Amf
- Subpackage
- Util
- Version
- $Id: BinaryStream.php 25241 2013-01-22 11:07:36Z frosch $
\Zend_Amf_Util_BinaryStream
Utility class to walk through a data stream byte by byte with conventional names
- Children
- \Zend_Amf_Parse_OutputStream
- \Zend_Amf_Parse_InputStream
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

bool $_mbStringFunctionsOverloaded = - Type
- bool
Methods

__construct(string $stream) : voidConstructor
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.
| Name | Type | Description |
|---|---|---|
| $stream | string | use '' if creating a new stream or pass a string if reading. |

readByte() : intReads a signed byte
| Type | Description |
|---|---|
| int | Value is in the range of -128 to 127. |
| Exception | Description |
|---|---|
| \Zend_Amf_Exception |

readBytes(int $length) : stringRead the number of bytes in a row for the length supplied.
| Name | Type | Description |
|---|---|---|
| $length | int |
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \Zend_Amf_Exception | for buffer underrun |
- Todo
- Should check that there are enough bytes left in the stream we are about to read.

readDouble() : doubleReads an IEEE 754 double-precision floating point number from the data stream.
| Type | Description |
|---|---|
| double | Floating point number |

readInt() : intReads a signed 32-bit integer from the data stream.
| Type | Description |
|---|---|
| int | Value is in the range of -2147483648 to 2147483647 |

readUnsignedShort() : doubleRead a 16 bit unsigned short.
| Type | Description |
|---|---|
| double |
- Todo
- This could use the unpack() w/ S,n, or v

readUtf() : stringReads a UTF-8 string from the data stream
| Type | Description |
|---|---|
| string | A UTF-8 string produced by the byte representation of characters |

writeByte(string $stream) : \Zend_Amf_Util_BinaryStreamWrites the passed string into a signed byte on the stream.
| Name | Type | Description |
|---|---|---|
| $stream | string |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |

writeBytes(string $bytes) : \Zend_Amf_Util_BinaryStreamWrite any length of bytes to the stream
Usually a string.
| Name | Type | Description |
|---|---|---|
| $bytes | string |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |

writeDouble(string | double $stream) : \Zend_Amf_Util_BinaryStreamWrites an IEEE 754 double-precision floating point number from the data stream.
| Name | Type | Description |
|---|---|---|
| $stream | string | double |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |

writeInt(int $stream) : \Zend_Amf_Util_BinaryStreamWrite an the integer to the output stream as a 32 bit signed integer
| Name | Type | Description |
|---|---|---|
| $stream | int |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |

writeLong(int | string $stream) : \Zend_Amf_Util_BinaryStreamWrite long numeric value to output stream
| Name | Type | Description |
|---|---|---|
| $stream | int | string |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |

writeLongUtf(string $stream) : \Zend_Amf_Util_BinaryStreamWrite a long UTF string to the buffer
| Name | Type | Description |
|---|---|---|
| $stream | string |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |

writeUtf(string $stream) : \Zend_Amf_Util_BinaryStreamWite a UTF-8 string to the outputstream
| Name | Type | Description |
|---|---|---|
| $stream | string |
| Type | Description |
|---|---|
| \Zend_Amf_Util_BinaryStream |