Hoa central
Public Member Functions | List of all members
Hoa\Stream\Wrapper\IWrapper\Stream Interface Reference
Inheritance diagram for Hoa\Stream\Wrapper\IWrapper\Stream:

Public Member Functions

 stream_cast ($castAs)
 
 stream_close ()
 
 stream_eof ()
 
 stream_flush ()
 
 stream_lock ($operation)
 
 stream_metadata ($path, $option, $value)
 
 stream_open ($path, $mode, $options, &$openedPath)
 
 stream_read ($count)
 
 stream_seek ($offset, $whence=SEEK_SET)
 
 stream_set_option ($option, $arg1, $arg2)
 
 stream_stat ()
 
 stream_tell ()
 
 stream_truncate ($size)
 
 stream_write ($data)
 

Detailed Description

Interface .

Interface for “stream stream wrapper” class.

Definition at line 47 of file Stream.php.

Member Function Documentation

Hoa\Stream\Wrapper\IWrapper\Stream::stream_cast (   $castAs)

Retrieve the underlaying resource.

Parameters
int$castAsCan be STREAM_CAST_FOR_SELECT when stream_select() is calling stream_cast() or STREAM_CAST_AS_STREAM when stream_cast() is called for other uses.
Returns
resource
Hoa\Stream\Wrapper\IWrapper\Stream::stream_close ( )

Close a resource. This method is called in response to fclose(). All resources that were locked, or allocated, by the wrapper should be released.

Returns
void
Hoa\Stream\Wrapper\IWrapper\Stream::stream_eof ( )

Tests for end-of-file on a file pointer. This method is called in response to feof().

Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_flush ( )

Flush the output. This method is called in response to fflush(). If we have cached data in our stream but not yet stored it into the underlying storage, we should do so now.

Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_lock (   $operation)

Advisory file locking. This method is called in response to flock(), when file_put_contents() (when flags contains LOCK_EX), stream_set_blocking() and when closing the stream (LOCK_UN).

Parameters
int$operationOperation is one the following:
  • LOCK_SH to acquire a shared lock (reader) ;
  • LOCK_EX to acquire an exclusive lock (writer) ;
  • LOCK_UN to release a lock (shared or exclusive) ;
  • LOCK_NB if we don't want flock() to block while locking (not supported on Windows).
Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_metadata (   $path,
  $option,
  $value 
)

Change stream options. This method is called to set metadata on the stream. It is called when one of the following functions is called one a stream URL: touch, chmod, chown or chgrp.

Parameters
string$pathThe file path or URL to set metadata.
int$optionOne of the following:
  • STREAM_META_TOUCH,
  • STREAM_META_OWNER_NAME,
  • STREAM_META_OWNER,
  • STREAM_META_GROUP_NAME,
  • STREAM_META_GROUP,
  • STREAM_META_ACCESS.
mixed$valueAn array or a scalar depending of the option.
Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_open (   $path,
  $mode,
  $options,
$openedPath 
)

Open file or URL. This method is called immediately after the wrapper is initialized (f.e. by fopen() and file_get_contents()).

Parameters
string$pathSpecifies the URL that was passed to the original function.
string$modeThe mode used to open the file, as detailed for fopen().
int$optionsHolds additional flags set by the streams API. It can hold one or more of the following values OR'd together:
  • STREAM_USE_PATH, if path is relative, search for the resource using the include_path;
  • STREAM_REPORT_ERRORS, if this is set, you are responsible for raising errors using trigger_error during opening the stream. If this is not set, you should not raise any errors.
string&$openedPathIf the $path is opened successfully, and STREAM_USE_PATH is set in $options, $openedPath should be set to the full path of the file/resource that was actually opened.
Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_read (   $count)

Read from stream. This method is called in response to fread() and fgets().

Parameters
int$countHow many bytes of data from the current position should be returned.
Returns
string
Hoa\Stream\Wrapper\IWrapper\Stream::stream_seek (   $offset,
  $whence = SEEK_SET 
)

Seek to specific location in a stream. This method is called in response to fseek(). The read/write position of the stream should be updated according to the $offset and $whence.

Parameters
int$offsetThe stream offset to seek to.
int$whencePossible values:
  • SEEK_SET to set position equal to $offset bytes ;
  • SEEK_CUR to set position to current location plus $offsete ;
  • SEEK_END to set position to end-of-file plus $offset.
Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_set_option (   $option,
  $arg1,
  $arg2 
)

Change stream options. This method is called to set options on the stream.

Parameters
int$optionOne of:
  • STREAM_OPTION_BLOCKING, the method was called in response to stream_set_blocking() ;
  • STREAM_OPTION_READ_TIMEOUT, the method was called in response to stream_set_timeout() ;
  • STREAM_OPTION_WRITE_BUFFER, the method was called in response to stream_set_write_buffer().
int$arg1If $option is:
  • STREAM_OPTION_BLOCKING: requested blocking mode (1 meaning block, 0 not blocking) ;
  • STREAM_OPTION_READ_TIMEOUT: the timeout in seconds ;
  • STREAM_OPTION_WRITE_BUFFER: buffer mode (STREAM_BUFFER_NONE or STREAM_BUFFER_FULL).
int$arg2If $option is:
  • STREAM_OPTION_BLOCKING: this option is not set ;
  • STREAM_OPTION_READ_TIMEOUT: the timeout in microseconds ;
  • STREAM_OPTION_WRITE_BUFFER: the requested buffer size.
Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_stat ( )

Retrieve information about a file resource. This method is called in response to fstat().

Returns
array
Hoa\Stream\Wrapper\IWrapper\Stream::stream_tell ( )

Retrieve the current position of a stream. This method is called in response to ftell().

Returns
int
Hoa\Stream\Wrapper\IWrapper\Stream::stream_truncate (   $size)

Truncate a stream to a given length.

Parameters
int$sizeSize.
Returns
bool
Hoa\Stream\Wrapper\IWrapper\Stream::stream_write (   $data)

Write to stream. This method is called in response to fwrite().

Parameters
string$dataShould be stored into the underlying stream.
Returns
int

The documentation for this interface was generated from the following file: