\Swift_Transport_StreamBuffer
A generic IoBuffer implementation supporting remote sockets and local processes.
- Author: Chris Corbyn
Synopsis
class Swift_Transport_StreamBuffer
extends Swift_ByteStream_AbstractFilterableInputStream
implements
Swift_Transport_IoBuffer
{
- // members
- private $_stream;
- private $_in;
- private $_out;
- private array $_params;
- private $_replacementFactory;
- private array $_translations;
- // Inherited members from Swift_ByteStream_AbstractFilterableInputStream
- protected integer $_sequence;
- // methods
- public void __construct()
- public void initialize()
- public void setParam()
- public void startTLS()
- public void terminate()
- public void setWriteTranslations()
- public string readLine()
- public string|boolean read()
- public void setReadPointer()
- protected void _flush()
- protected void _commit()
- private void _establishSocketConnection()
- private void _establishProcessConnection()
- private void _getReadConnectionDescription()
- // Inherited methods from Swift_ByteStream_AbstractFilterableInputStream
- protected abstract void _commit()
- protected abstract void _flush()
- public void addFilter()
- public void removeFilter()
- public integer write()
- public void commit()
- public void bind()
- public void unbind()
- public void flushBuffers()
Hierarchy
Constants
Name | Value |
---|---|
TYPE_SOCKET | 0x0001 |
TYPE_PROCESS | 0x0010 |
Members
private
-
$_in
The input stream -
$_out
The output stream -
$_params
Buffer initialization parameters -
$_replacementFactory
The ReplacementFilterFactory -
$_stream
A primary socket -
$_translations
Translations performed on data being streamed into the buffer
protected
-
$_sequence
Write sequence.
Methods
private
- _establishProcessConnection() — Opens a process for input/output.
- _establishSocketConnection() — Establishes a connection to a remote server.
- _getReadConnectionDescription()
protected
public
- __construct() — Create a new StreamBuffer using $replacementFactory for transformations.
- initialize() — Perform any initialization needed, using the given $params.
- read() — Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
- readLine() — Get a line of output (including any CRLF).
- setParam() — Set an individual param on the buffer (e.g. switching to SSL).
- setReadPointer() — Not implemented
- setWriteTranslations() — Set an array of string replacements which should be made on data written to the buffer.
- startTLS()
- terminate() — Perform any shutdown logic needed.
Inherited from Swift_ByteStream_AbstractFilterableInputStream
protected
- _commit() — Commit the given bytes to the storage medium immediately.
- _flush() — Flush any buffers/content with immediate effect.
public
- addFilter() — Add a StreamFilter to this InputByteStream.
- bind() — Attach $is to this stream.
- commit() — For any bytes that are currently buffered inside the stream, force them off the buffer.
- flushBuffers() — Flush the contents of the stream (empty it) and set the internal pointer to the beginning.
- removeFilter() — Remove an already present StreamFilter based on its $key.
- unbind() — Remove an already bound stream.
- write() — Writes $bytes to the end of the stream.