TYPO3  7.6
Public Member Functions | Private Attributes | List of all members
Swift_ByteStream_ArrayByteStream Class Reference
Inheritance diagram for Swift_ByteStream_ArrayByteStream:
Swift_InputByteStream Swift_OutputByteStream

Public Member Functions

 __construct ($stack=null)
 
 read ($length)
 
 write ($bytes)
 
 commit ()
 
 bind (Swift_InputByteStream $is)
 
 unbind (Swift_InputByteStream $is)
 
 setReadPointer ($byteOffset)
 
 flushBuffers ()
 

Private Attributes

 $_array = array()
 
 $_arraySize = 0
 
 $_offset = 0
 
 $_mirrors = array()
 

Detailed Description

Allows reading and writing of bytes to and from an array.

Author
Chris Corbyn

Definition at line 16 of file ArrayByteStream.php.

Constructor & Destructor Documentation

__construct (   $stack = null)

Create a new ArrayByteStream.

If $stack is given the stream will be populated with the bytes it contains.

Parameters
mixed$stackof bytes in string or array form, optional

Definition at line 53 of file ArrayByteStream.php.

References elseif, and write().

Member Function Documentation

bind ( Swift_InputByteStream  $is)

Attach $is to this stream.

The stream acts as an observer, receiving all data that is written. All write() and flushBuffers() operations will be mirrored.

Parameters
Swift_InputByteStream$is

Implements Swift_InputByteStream.

Definition at line 129 of file ArrayByteStream.php.

commit ( )

Not used.

Implements Swift_InputByteStream.

Definition at line 117 of file ArrayByteStream.php.

flushBuffers ( )

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

Implements Swift_InputByteStream.

Definition at line 174 of file ArrayByteStream.php.

read (   $length)

Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.

If less bytes exist than are requested the remaining bytes are given instead. If no bytes are remaining at all, boolean false is returned.

Parameters
int$length
Returns
string

Implements Swift_OutputByteStream.

Definition at line 77 of file ArrayByteStream.php.

References $_offset.

setReadPointer (   $byteOffset)

Move the internal read pointer to $byteOffset in the stream.

Parameters
int$byteOffset
Returns
bool

Implements Swift_OutputByteStream.

Definition at line 159 of file ArrayByteStream.php.

References $_arraySize, and elseif.

unbind ( Swift_InputByteStream  $is)

Remove an already bound stream.

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.

Parameters
Swift_InputByteStream$is

Implements Swift_InputByteStream.

Definition at line 143 of file ArrayByteStream.php.

write (   $bytes)

Writes $bytes to the end of the stream.

Parameters
string$bytes

Implements Swift_InputByteStream.

Definition at line 101 of file ArrayByteStream.php.

Referenced by __construct().

Member Data Documentation

$_array = array()
private

Definition at line 23 of file ArrayByteStream.php.

$_arraySize = 0
private

Definition at line 30 of file ArrayByteStream.php.

Referenced by setReadPointer().

$_mirrors = array()
private

Definition at line 44 of file ArrayByteStream.php.

$_offset = 0
private

Definition at line 37 of file ArrayByteStream.php.

Referenced by read().