\Swift_ByteStream_FileByteStream
Allows reading and writing of bytes to and from a file.
- Author: Chris Corbyn
Synopsis
class Swift_ByteStream_FileByteStream
extends Swift_ByteStream_AbstractFilterableInputStream
implements
Swift_FileStream
{
- // members
- private integer $_offset;
- private $_path;
- private $_mode;
- private $_reader;
- private $_writer;
- private $_quotes;
- private $_seekable;
- // Inherited members from Swift_ByteStream_AbstractFilterableInputStream
- protected integer $_sequence;
- // methods
- public void __construct()
- public string getPath()
- public string read()
- public boolean setReadPointer()
- protected void _commit()
- protected void _flush()
- private void _getReadHandle()
- private void _getWriteHandle()
- private void _resetReadHandle()
- private void _getReadStreamSeekableStatus()
- private void _seekReadStreamToPosition()
- private void _copyReadStream()
- // 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
Extends
Extended by
Implements
Members
private
-
$_mode
The mode this file is opened in for writing -
$_offset
The internal pointer offset -
$_path
The path to the file -
$_quotes
If magic_quotes_runtime is on, this will be true -
$_reader
A lazy-loaded resource handle for reading the file -
$_seekable
If stream is seekable true/false, or null if not known -
$_writer
A lazy-loaded resource handle for writing the file
protected
-
$_sequence
Write sequence.
Methods
private
- _copyReadStream() — Copy a readOnly Stream to ensure seekability
- _getReadHandle() — Get the resource for reading
- _getReadStreamSeekableStatus() — Check if ReadOnly Stream is seekable
- _getWriteHandle() — Get the resource for writing
- _resetReadHandle() — Force a reload of the resource for reading
- _seekReadStreamToPosition() — Streams in a readOnly stream ensuring copy if needed
protected
public
- __construct() — Create a new FileByteStream for $path.
- getPath() — Get the complete path to the file.
- read() — Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
- setReadPointer() — Move the internal read pointer to $byteOffset in the stream.
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.