PHP Class Jackalope\BinaryStreamWrapper

The stream is registered for the protocol "jackalope://". The URL must contain the sessions registryKey as the host part and the oath of the binary property as the path part, e.g. "jackalope://abc0123/content/node/binary" For multivalued properties the url also contains the position of the stream in the property array in the port field and a token to identify all streams loaded by the single backend call in an static array as username. The loading from the backend is deferred until the stream is accessed. Then it is loaded and all stream functions are passed on to the underlying stream. This means after closing the Session, streams can no longer be accessed.
Show file Open project: jackalope/jackalope

Public Methods

Method Description
stream_close ( ) Close this stream if it was initialized
stream_eof ( ) : boolean Make sure the stream is ready and check whether the stream is at its end.
stream_flush ( ) Flush all data written to this stream if the stream was initialized.
stream_open ( string $path, integer $mode, integer $options, mixed &$opened_path ) : boolean Get the information and store it for later usage.
stream_read ( integer $count ) : string Make sure the stream is ready and read from the underlying stream.
stream_seek ( integer $offset, integer $whence ) : integer Make sure the stream is ready and position the file pointer to the specified position.
stream_stat ( ) : array Make sure the stream is ready and get information about the stream.
stream_tell ( ) Make sure the stream is ready and specify the position in the stream.
stream_write ( string $data ) : integer Make sure the stream is ready and write to the underlying stream.
url_stat ( string $path, integer $flags ) : array Retrieve information about a file

Private Methods

Method Description
init_stream ( ) Check whether stream was already loaded, otherwise fetch from backend and cache it.

Method Details

stream_close() public method

Close this stream if it was initialized
public stream_close ( )

stream_eof() public method

Make sure the stream is ready and check whether the stream is at its end.
public stream_eof ( ) : boolean
return boolean true if the stream has ended.

stream_flush() public method

Flush all data written to this stream if the stream was initialized.
public stream_flush ( )

stream_open() public method

Get the information and store it for later usage.
public stream_open ( string $path, integer $mode, integer $options, mixed &$opened_path ) : boolean
$path string the backend path for this stream
$mode integer ignored
$options integer ignored
$opened_path mixed ignored
return boolean true on success

stream_read() public method

Make sure the stream is ready and read from the underlying stream.
public stream_read ( integer $count ) : string
$count integer How many bytes to read from the stream.
return string data from the stream in utf-8 format.

stream_seek() public method

Make sure the stream is ready and position the file pointer to the specified position.
public stream_seek ( integer $offset, integer $whence ) : integer
$offset integer the position in the stream in bytes from the beginning
$whence integer whether to seek relative or absolute
return integer

stream_stat() public method

Make sure the stream is ready and get information about the stream.
public stream_stat ( ) : array
return array

stream_tell() public method

Make sure the stream is ready and specify the position in the stream.
public stream_tell ( )

stream_write() public method

Make sure the stream is ready and write to the underlying stream.
public stream_write ( string $data ) : integer
$data string the data to write to the stream (utf-8)
return integer

url_stat() public method

Retrieve information about a file
See also: http://php.net/manual/en/streamwrapper.url-stat.php
public url_stat ( string $path, integer $flags ) : array
$path string The backend path for this stream, e.g. jackalope://abc0123/content/node/binary
$flags integer ignored
return array Should return as many elements as stat() does. Unknown or unavailable values should be set to a rational value (usually 0).