PHP Class Swift_ByteStream_FileByteStream, Halite

Author: Chris Corbyn
Inheritance: extends Swift_ByteStream_AbstractFilterableInputStream, implements Swift_FileStream
Show file Open project: HaliteChallenge/Halite Class Usage Examples

Public Methods

Method Description
__construct ( string $path, boolean $writable = false ) Create a new FileByteStream for $path.
getPath ( ) : string Get the complete path to the file.
read ( integer $length ) : string | boolean Reads $length bytes from the stream into a string and moves the pointer through the stream by $length.
setReadPointer ( integer $byteOffset ) : boolean Move the internal read pointer to $byteOffset in the stream.

Protected Methods

Method Description
_commit ( $bytes ) Just write the bytes to the file
_flush ( ) Not used

Private Methods

Method Description
_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 ( $offset ) Streams in a readOnly stream ensuring copy if needed

Method Details

__construct() public method

Create a new FileByteStream for $path.
public __construct ( string $path, boolean $writable = false )
$path string
$writable boolean if true

_commit() protected method

Just write the bytes to the file
protected _commit ( $bytes )

_flush() protected method

Not used
protected _flush ( )

getPath() public method

Get the complete path to the file.
public getPath ( ) : string
return string

read() public method

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 read ( integer $length ) : string | boolean
$length integer
return string | boolean

setReadPointer() public method

Move the internal read pointer to $byteOffset in the stream.
public setReadPointer ( integer $byteOffset ) : boolean
$byteOffset integer
return boolean