Open Journal Systems  3.3.0
GuzzleHttp\Psr7\Stream Class Reference
Inheritance diagram for GuzzleHttp\Psr7\Stream:
Psr\Http\Message\StreamInterface

Public Member Functions

 __construct ($stream, $options=[])
 
 __destruct ()
 
 __toString ()
 
 close ()
 
 detach ()
 
 eof ()
 
 getContents ()
 
 getMetadata ($key=null)
 
 getSize ()
 
 isReadable ()
 
 isSeekable ()
 
 isWritable ()
 
 read ($length)
 
 rewind ()
 
 seek ($offset, $whence=SEEK_SET)
 
 tell ()
 
 write ($string)
 

Data Fields

const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/'
 
const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/'
 

Detailed Description

Definition at line 11 of file vendor/guzzlehttp/psr7/src/Stream.php.

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Psr7\Stream::__construct (   $stream,
  $options = [] 
)

This constructor accepts an associative array of options.

  • size: (int) If a read stream would otherwise have an indeterminate size, but the size is known due to foreknowledge, then you can provide that size, in bytes.
  • metadata: (array) Any additional metadata to return when the metadata of the stream is accessed.
Parameters
resource$streamStream resource to wrap.
array$optionsAssociative array of options.
Exceptions

Definition at line 46 of file vendor/guzzlehttp/psr7/src/Stream.php.

References GuzzleHttp\Psr7\Stream\getMetadata().

◆ __destruct()

GuzzleHttp\Psr7\Stream::__destruct ( )

Closes the stream when the destructed

Definition at line 71 of file vendor/guzzlehttp/psr7/src/Stream.php.

References GuzzleHttp\Psr7\Stream\close().

Member Function Documentation

◆ __toString()

GuzzleHttp\Psr7\Stream::__toString ( )

Reads all data from the stream into a string, from the beginning to end.

This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.

Warning: This could attempt to load a large amount of data into memory.

This method MUST NOT raise an exception in order to conform with PHP's string casting operations.

See also
http://php.net/manual/en/language.oop5.magic.php#object.tostring
Returns
string

Implements Psr\Http\Message\StreamInterface.

Definition at line 76 of file vendor/guzzlehttp/psr7/src/Stream.php.

References GuzzleHttp\Psr7\Stream\seek().

◆ close()

GuzzleHttp\Psr7\Stream::close ( )

Closes the stream and any underlying resources.

Returns
void

Implements Psr\Http\Message\StreamInterface.

Definition at line 101 of file vendor/guzzlehttp/psr7/src/Stream.php.

References GuzzleHttp\Psr7\Stream\detach().

Referenced by GuzzleHttp\Psr7\Stream\__destruct().

◆ detach()

GuzzleHttp\Psr7\Stream::detach ( )

Separates any underlying resources from the stream.

After the stream has been detached, the stream is in an unusable state.

Returns
resource|null Underlying PHP stream, if any

Implements Psr\Http\Message\StreamInterface.

Definition at line 111 of file vendor/guzzlehttp/psr7/src/Stream.php.

Referenced by GuzzleHttp\Psr7\Stream\close().

◆ eof()

GuzzleHttp\Psr7\Stream::eof ( )

Returns true if the stream is at the end of the stream.

Returns
bool

Implements Psr\Http\Message\StreamInterface.

Definition at line 164 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ getContents()

GuzzleHttp\Psr7\Stream::getContents ( )

Returns the remaining contents in a string

Returns
string
Exceptions

Implements Psr\Http\Message\StreamInterface.

Definition at line 86 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ getMetadata()

GuzzleHttp\Psr7\Stream::getMetadata (   $key = null)

Get stream metadata as an associative array or retrieve a specific key.

The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function.

string $key Specific metadata to retrieve. array|mixed|null Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found.

Implements Psr\Http\Message\StreamInterface.

Definition at line 253 of file vendor/guzzlehttp/psr7/src/Stream.php.

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

◆ getSize()

GuzzleHttp\Psr7\Stream::getSize ( )

Get the size of the stream if known.

Returns
int|null Returns the size in bytes if known, or null if unknown.

Implements Psr\Http\Message\StreamInterface.

Definition at line 125 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ isReadable()

GuzzleHttp\Psr7\Stream::isReadable ( )

Returns whether or not the stream is readable.

Returns
bool

Implements Psr\Http\Message\StreamInterface.

Definition at line 149 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ isSeekable()

GuzzleHttp\Psr7\Stream::isSeekable ( )

Returns whether or not the stream is seekable.

Returns
bool

Implements Psr\Http\Message\StreamInterface.

Definition at line 159 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ isWritable()

GuzzleHttp\Psr7\Stream::isWritable ( )

Returns whether or not the stream is writable.

Returns
bool

Implements Psr\Http\Message\StreamInterface.

Definition at line 154 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ read()

GuzzleHttp\Psr7\Stream::read (   $length)

Read data from the stream.

Parameters
int$lengthRead up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes.
Returns
string Returns the data read from the stream, or an empty string if no bytes are available.
Exceptions

Implements Psr\Http\Message\StreamInterface.

Definition at line 209 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ rewind()

GuzzleHttp\Psr7\Stream::rewind ( )

Seek to the beginning of the stream.

If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).

See also
seek() on failure.

Implements Psr\Http\Message\StreamInterface.

Definition at line 188 of file vendor/guzzlehttp/psr7/src/Stream.php.

References GuzzleHttp\Psr7\Stream\seek().

◆ seek()

◆ tell()

GuzzleHttp\Psr7\Stream::tell ( )

Returns the current position of the file read/write pointer

Returns
int Position of the file pointer
Exceptions

Implements Psr\Http\Message\StreamInterface.

Definition at line 173 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ write()

GuzzleHttp\Psr7\Stream::write (   $string)

Write data to the stream.

Parameters
string$stringThe string that is to be written.
Returns
int Returns the number of bytes written to the stream.
Exceptions

Implements Psr\Http\Message\StreamInterface.

Definition at line 233 of file vendor/guzzlehttp/psr7/src/Stream.php.

Field Documentation

◆ READABLE_MODES

const GuzzleHttp\Psr7\Stream::READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/'

Definition at line 21 of file vendor/guzzlehttp/psr7/src/Stream.php.

◆ WRITABLE_MODES

const GuzzleHttp\Psr7\Stream::WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/'

Definition at line 22 of file vendor/guzzlehttp/psr7/src/Stream.php.


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