ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
GuzzleHttp\Psr7\LazyOpenStream Class Reference

Lazily reads or writes to a file that is opened only after an IO operation take place on the stream. More...

+ Inheritance diagram for GuzzleHttp\Psr7\LazyOpenStream:
+ Collaboration diagram for GuzzleHttp\Psr7\LazyOpenStream:

Public Member Functions

 __construct ($filename, $mode)
 
- Public Member Functions inherited from Psr\Http\Message\StreamInterface
 __toString ()
 Reads all data from the stream into a string, from the beginning to end. More...
 
 close ()
 Closes the stream and any underlying resources. More...
 
 detach ()
 Separates any underlying resources from the stream. More...
 
 getSize ()
 Get the size of the stream if known. More...
 
 tell ()
 Returns the current position of the file read/write pointer. More...
 
 eof ()
 Returns true if the stream is at the end of the stream. More...
 
 isSeekable ()
 Returns whether or not the stream is seekable. More...
 
 seek ($offset, $whence=SEEK_SET)
 Seek to a position in the stream. More...
 
 rewind ()
 Seek to the beginning of the stream. More...
 
 isWritable ()
 Returns whether or not the stream is writable. More...
 
 write ($string)
 Write data to the stream. More...
 
 isReadable ()
 Returns whether or not the stream is readable. More...
 
 read ($length)
 Read data from the stream. More...
 
 getContents ()
 Returns the remaining contents in a string. More...
 
 getMetadata ($key=null)
 Get stream metadata as an associative array or retrieve a specific key. More...
 

Protected Member Functions

 createStream ()
 Creates the underlying stream lazily when required. More...
 

Private Attributes

 $filename
 
 $mode
 

Detailed Description

Lazily reads or writes to a file that is opened only after an IO operation take place on the stream.

Definition at line 10 of file LazyOpenStream.php.

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Psr7\LazyOpenStream::__construct (   $filename,
  $mode 
)
Parameters
string$filenameFile to lazily open
string$modefopen mode to use when opening the stream

Definition at line 24 of file LazyOpenStream.php.

References GuzzleHttp\Psr7\LazyOpenStream\$filename, and GuzzleHttp\Psr7\LazyOpenStream\$mode.

25  {
26  $this->filename = $filename;
27  $this->mode = $mode;
28  }

Member Function Documentation

◆ createStream()

GuzzleHttp\Psr7\LazyOpenStream::createStream ( )
protected

Creates the underlying stream lazily when required.

Returns
StreamInterface

Definition at line 35 of file LazyOpenStream.php.

References GuzzleHttp\Psr7\stream_for().

36  {
37  return stream_for(try_fopen($this->filename, $this->mode));
38  }
stream_for($resource='', array $options=[])
Create a new stream based on the input type.
Definition: functions.php:78
+ Here is the call graph for this function:

Field Documentation

◆ $filename

GuzzleHttp\Psr7\LazyOpenStream::$filename
private

Definition at line 15 of file LazyOpenStream.php.

Referenced by GuzzleHttp\Psr7\LazyOpenStream\__construct().

◆ $mode

GuzzleHttp\Psr7\LazyOpenStream::$mode
private

Definition at line 18 of file LazyOpenStream.php.

Referenced by GuzzleHttp\Psr7\LazyOpenStream\__construct().


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