TYPO3  7.6
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Swift_ByteStream_FileByteStream Class Reference
Inheritance diagram for Swift_ByteStream_FileByteStream:
Swift_ByteStream_AbstractFilterableInputStream Swift_FileStream Swift_InputByteStream Swift_Filterable Swift_OutputByteStream Swift_ByteStream_TemporaryFileByteStream

Public Member Functions

 __construct ($path, $writable=false)
 
 getPath ()
 
 read ($length)
 
 setReadPointer ($byteOffset)
 
- Public Member Functions inherited from Swift_ByteStream_AbstractFilterableInputStream
 addFilter (Swift_StreamFilter $filter, $key)
 
 removeFilter ($key)
 
 write ($bytes)
 
 commit ()
 
 bind (Swift_InputByteStream $is)
 
 unbind (Swift_InputByteStream $is)
 
 flushBuffers ()
 

Protected Member Functions

 _commit ($bytes)
 
 _flush ()
 
- Protected Member Functions inherited from Swift_ByteStream_AbstractFilterableInputStream
 _commit ($bytes)
 
 _flush ()
 

Private Member Functions

 _getReadHandle ()
 
 _getWriteHandle ()
 
 _resetReadHandle ()
 
 _getReadStreamSeekableStatus ()
 
 _seekReadStreamToPosition ($offset)
 
 _copyReadStream ()
 

Private Attributes

 $_offset = 0
 
 $_path
 
 $_mode
 
 $_reader
 
 $_writer
 
 $_quotes = false
 
 $_seekable = null
 

Additional Inherited Members

- Protected Attributes inherited from Swift_ByteStream_AbstractFilterableInputStream
 $_sequence = 0
 

Detailed Description

Allows reading and writing of bytes to and from a file.

Author
Chris Corbyn

Definition at line 16 of file FileByteStream.php.

Constructor & Destructor Documentation

__construct (   $path,
  $writable = false 
)

Create a new FileByteStream for $path.

Parameters
string$path
bool$writableif true

Definition at line 45 of file FileByteStream.php.

Member Function Documentation

_commit (   $bytes)
protected

Just write the bytes to the file

Definition at line 127 of file FileByteStream.php.

References _getWriteHandle(), and _resetReadHandle().

_copyReadStream ( )
private

Copy a readOnly Stream to ensure seekability

Definition at line 206 of file FileByteStream.php.

References elseif.

Referenced by _seekReadStreamToPosition().

_flush ( )
protected

Not used

Definition at line 134 of file FileByteStream.php.

_getReadHandle ( )
private

Get the resource for reading

Definition at line 139 of file FileByteStream.php.

References $_reader, _getReadStreamSeekableStatus(), and _seekReadStreamToPosition().

Referenced by read().

_getReadStreamSeekableStatus ( )
private

Check if ReadOnly Stream is seekable

Definition at line 180 of file FileByteStream.php.

Referenced by _getReadHandle(), and _seekReadStreamToPosition().

_getWriteHandle ( )
private

Get the resource for writing

Definition at line 157 of file FileByteStream.php.

References $_writer.

Referenced by _commit().

_resetReadHandle ( )
private

Force a reload of the resource for reading

Definition at line 171 of file FileByteStream.php.

Referenced by _commit(), and read().

_seekReadStreamToPosition (   $offset)
private

Streams in a readOnly stream ensuring copy if needed

Definition at line 187 of file FileByteStream.php.

References _copyReadStream(), and _getReadStreamSeekableStatus().

Referenced by _getReadHandle(), and setReadPointer().

getPath ( )

Get the complete path to the file.

Returns
string

Implements Swift_FileStream.

Definition at line 63 of file FileByteStream.php.

References $_path.

Referenced by Swift_ByteStream_TemporaryFileByteStream\__destruct(), and Swift_ByteStream_TemporaryFileByteStream\getContent().

read (   $length)

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.

Parameters
int$length
Exceptions
Swift_IoException
Returns
string|bool

Implements Swift_OutputByteStream.

Definition at line 82 of file FileByteStream.php.

References _getReadHandle(), and _resetReadHandle().

setReadPointer (   $byteOffset)

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

Parameters
int$byteOffset
Returns
bool

Implements Swift_OutputByteStream.

Definition at line 118 of file FileByteStream.php.

References _seekReadStreamToPosition().

Member Data Documentation

$_mode
private

The mode this file is opened in for writing

Definition at line 25 of file FileByteStream.php.

$_offset = 0
private

The internal pointer offset

Definition at line 19 of file FileByteStream.php.

$_path
private

The path to the file

Definition at line 22 of file FileByteStream.php.

Referenced by getPath().

$_quotes = false
private

If magic_quotes_runtime is on, this will be true

Definition at line 34 of file FileByteStream.php.

$_reader
private

A lazy-loaded resource handle for reading the file

Definition at line 28 of file FileByteStream.php.

Referenced by _getReadHandle().

$_seekable = null
private

If stream is seekable true/false, or null if not known

Definition at line 37 of file FileByteStream.php.

$_writer
private

A lazy-loaded resource handle for writing the file

Definition at line 31 of file FileByteStream.php.

Referenced by _getWriteHandle().