Class Swift_ByteStream_ArrayByteStream

InheritanceSwift_ByteStream_ArrayByteStream
ImplementsSwift_InputByteStream, Swift_OutputByteStream

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

Public Methods

Hide inherited methods

MethodDescriptionDefined 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

__construct() public method

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

bind() public method

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
commit() public method

Not used.

public void commit ( )
flushBuffers() public method

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

public void flushBuffers ( )
read() public method

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
setReadPointer() public method

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

public bool setReadPointer ( $byteOffset )
$byteOffset int
unbind() public method

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
write() public method

Writes $bytes to the end of the stream.

public void write ( $bytes )
$bytes string