Class Swift_ByteStream_ArrayByteStream
Inheritance | Swift_ByteStream_ArrayByteStream |
---|---|
Implements | Swift_InputByteStream, Swift_OutputByteStream |
Allows reading and writing of bytes to and from an array.
Public Methods
Method | Description | Defined By |
---|---|---|
__construct() | Create a new ArrayByteStream. | Swift_ByteStream_ArrayByteStream |
bind() | Attach $is to this stream. | Swift_ByteStream_ArrayByteStream |
commit() | Not used. | Swift_ByteStream_ArrayByteStream |
flushBuffers() | Flush the contents of the stream (empty it) and set the internal pointer to the beginning. | Swift_ByteStream_ArrayByteStream |
read() | Reads $length bytes from the stream into a string and moves the pointer through the stream by $length. | Swift_ByteStream_ArrayByteStream |
setReadPointer() | Move the internal read pointer to $byteOffset in the stream. | Swift_ByteStream_ArrayByteStream |
unbind() | Remove an already bound stream. | Swift_ByteStream_ArrayByteStream |
write() | Writes $bytes to the end of the stream. | Swift_ByteStream_ArrayByteStream |
Method Details
Create a new ArrayByteStream.
If $stack is given the stream will be populated with the bytes it contains.
public void __construct ( $stack = null ) | ||
$stack | mixed | Of bytes in string or array form, optional |
Attach $is to this stream.
The stream acts as an observer, receiving all data that is written. All {@link write()} and {@link flushBuffers()} operations will be mirrored.
public void bind ( Swift_InputByteStream $is ) | ||
$is | Swift_InputByteStream |
Not used.
public void commit ( ) |
Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
public void flushBuffers ( ) |
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.
public string read ( $length ) | ||
$length | int |
Move the internal read pointer to $byteOffset in the stream.
public bool setReadPointer ( $byteOffset ) | ||
$byteOffset | int |
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.
public void unbind ( Swift_InputByteStream $is ) | ||
$is | Swift_InputByteStream |
Writes $bytes to the end of the stream.
public void write ( $bytes ) | ||
$bytes | string |