PHP Class Swift_ByteStream_ArrayByteStream, Halite

Author: Chris Corbyn
Inheritance: implements Swift_InputByteStream, implements Swift_OutputByteStream
Exibir arquivo Open project: HaliteChallenge/Halite Class Usage Examples

Public Methods

Method Description
__construct ( mixed $stack = null ) Create a new ArrayByteStream.
bind ( Swift_InputByteStream $is ) Attach $is to this stream.
commit ( ) Not used.
flushBuffers ( ) Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
read ( integer $length ) : string Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
setReadPointer ( integer $byteOffset ) : boolean Move the internal read pointer to $byteOffset in the stream.
unbind ( Swift_InputByteStream $is ) Remove an already bound stream.
write ( string $bytes ) Writes $bytes to the end of the stream.

Method Details

__construct() public method

If $stack is given the stream will be populated with the bytes it contains.
public __construct ( mixed $stack = null )
$stack mixed of bytes in string or array form, optional

bind() public method

The stream acts as an observer, receiving all data that is written. All {@link write()} and {@link flushBuffers()} operations will be mirrored.
public bind ( Swift_InputByteStream $is )
$is Swift_InputByteStream

commit() public method

Not used.
public commit ( )

flushBuffers() public method

Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
public flushBuffers ( )

read() public method

If less bytes exist than are requested the remaining bytes are given instead. If no bytes are remaining at all, boolean false is returned.
public read ( integer $length ) : string
$length integer
return string

setReadPointer() public method

Move the internal read pointer to $byteOffset in the stream.
public setReadPointer ( integer $byteOffset ) : boolean
$byteOffset integer
return boolean

unbind() public method

If $is is not bound, no errors will be raised. If the stream currently has any buffered data it will be written to $is before unbinding occurs.
public unbind ( Swift_InputByteStream $is )
$is Swift_InputByteStream

write() public method

Writes $bytes to the end of the stream.
public write ( string $bytes )
$bytes string