Open Journal Systems  3.3.0
Guzzle\Stream\Stream Class Reference
Inheritance diagram for Guzzle\Stream\Stream:
Guzzle\Stream\StreamInterface Guzzle\Http\EntityBody

Public Member Functions

 __construct ($stream, $size=null)
 
 __destruct ()
 
 __toString ()
 
 close ()
 
 detachStream ()
 
 feof ()
 
 ftell ()
 
 getCustomData ($key)
 
 getMetaData ($key=null)
 
 getSize ()
 
 getStream ()
 
 getStreamType ()
 
 getUri ()
 
 getWrapper ()
 
 getWrapperData ()
 
 isConsumed ()
 
 isLocal ()
 
 isReadable ()
 
 isRepeatable ()
 
 isSeekable ()
 
 isWritable ()
 
 read ($length)
 
 readLine ($maxLength=null)
 
 rewind ()
 
 seek ($offset, $whence=SEEK_SET)
 
 setCustomData ($key, $value)
 
 setSize ($size)
 
 setStream ($stream, $size=null)
 
 write ($string)
 

Static Public Member Functions

static getHash (StreamInterface $stream, $algo, $rawOutput=false)
 

Data Fields

const IS_LOCAL = 'is_local'
 
const IS_READABLE = 'is_readable'
 
const IS_WRITABLE = 'is_writable'
 
const SEEKABLE = 'seekable'
 
const STREAM_TYPE = 'stream_type'
 
const WRAPPER_TYPE = 'wrapper_type'
 

Protected Member Functions

 rebuildCache ()
 

Protected Attributes

 $cache = array()
 
 $customData = array()
 
 $size
 
 $stream
 

Static Protected Attributes

static $readWriteHash
 

Detailed Description

PHP stream implementation

Definition at line 10 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Stream\Stream::__construct (   $stream,
  $size = null 
)
Parameters
resource$streamStream resource to wrap
int$sizeSize of the stream in bytes. Only pass if the size cannot be obtained from the stream.
Exceptions
InvalidArgumentExceptionif the stream is not a stream resource

Definition at line 63 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\$size, Guzzle\Stream\Stream\$stream, and Guzzle\Stream\Stream\setStream().

◆ __destruct()

Guzzle\Stream\Stream::__destruct ( )

Closes the stream when the helper is destructed

Definition at line 71 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\close().

Member Function Documentation

◆ __toString()

Guzzle\Stream\Stream::__toString ( )

Convert the stream to a string if the stream is readable and the stream is seekable.

Returns
string

Implements Guzzle\Stream\StreamInterface.

Definition at line 76 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\ftell(), Guzzle\Stream\Stream\isConsumed(), Guzzle\Stream\Stream\isReadable(), Guzzle\Stream\Stream\isSeekable(), and Guzzle\Stream\Stream\seek().

◆ close()

Guzzle\Stream\Stream::close ( )

◆ detachStream()

Guzzle\Stream\Stream::detachStream ( )

Detach the current stream resource

Returns
self

Implements Guzzle\Stream\StreamInterface.

Definition at line 150 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ feof()

Guzzle\Stream\Stream::feof ( )

Alias of isConsumed

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 220 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\isConsumed().

Referenced by Guzzle\Stream\Stream\isConsumed().

◆ ftell()

Guzzle\Stream\Stream::ftell ( )

Returns the current position of the file read/write pointer

Returns
int|bool Returns the position of the file pointer or false on error

Implements Guzzle\Stream\StreamInterface.

Definition at line 260 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

Referenced by Guzzle\Stream\Stream\__toString(), and Guzzle\Stream\Stream\getSize().

◆ getCustomData()

Guzzle\Stream\Stream::getCustomData (   $key)

Get custom data from the stream

Parameters
string$keyKey to retrieve
Returns
null|mixed

Implements Guzzle\Stream\StreamInterface.

Definition at line 286 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ getHash()

static Guzzle\Stream\Stream::getHash ( StreamInterface  $stream,
  $algo,
  $rawOutput = false 
)
static

Calculate a hash of a Stream

Parameters
StreamInterface$streamStream to calculate the hash for
string$algoHash algorithm (e.g. md5, crc32, etc)
bool$rawOutputWhether or not to use raw output
Returns
bool|string Returns false on failure or a hash string on success

Definition at line 107 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\$stream.

Referenced by Guzzle\Http\AbstractEntityBodyDecorator\getContentMd5().

◆ getMetaData()

Guzzle\Stream\Stream::getMetaData (   $key = null)

Get stream metadata

Parameters
string$keySpecific metadata to retrieve
Returns
array|mixed|null

Implements Guzzle\Stream\StreamInterface.

Definition at line 125 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

Referenced by Guzzle\Stream\Stream\getWrapperData().

◆ getSize()

Guzzle\Stream\Stream::getSize ( )

◆ getStream()

Guzzle\Stream\Stream::getStream ( )

Get the stream resource

Returns
resource

Implements Guzzle\Stream\StreamInterface.

Definition at line 132 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\$stream.

Referenced by Guzzle\Stream\Stream\readLine().

◆ getStreamType()

Guzzle\Stream\Stream::getStreamType ( )

Get a label describing the underlying implementation of the stream

Returns
string

Implements Guzzle\Stream\StreamInterface.

Definition at line 167 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\STREAM_TYPE.

◆ getUri()

Guzzle\Stream\Stream::getUri ( )

Get the URI/filename associated with this stream

Returns
string

Implements Guzzle\Stream\StreamInterface.

Definition at line 172 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

Referenced by Guzzle\Http\EntityBody\getContentType().

◆ getWrapper()

Guzzle\Stream\Stream::getWrapper ( )

Get the stream wrapper type

Returns
string

Implements Guzzle\Stream\StreamInterface.

Definition at line 157 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\WRAPPER_TYPE.

◆ getWrapperData()

Guzzle\Stream\Stream::getWrapperData ( )

Wrapper specific data attached to this stream.

Returns
array

Implements Guzzle\Stream\StreamInterface.

Definition at line 162 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\getMetaData().

◆ isConsumed()

Guzzle\Stream\Stream::isConsumed ( )

◆ isLocal()

Guzzle\Stream\Stream::isLocal ( )

Check if the stream is a local stream vs a remote stream

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 225 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\IS_LOCAL.

◆ isReadable()

Guzzle\Stream\Stream::isReadable ( )

◆ isRepeatable()

Guzzle\Stream\Stream::isRepeatable ( )

Check if the stream is repeatable

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 205 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\IS_READABLE, and Guzzle\Stream\Stream\SEEKABLE.

◆ isSeekable()

Guzzle\Stream\Stream::isSeekable ( )

◆ isWritable()

Guzzle\Stream\Stream::isWritable ( )

Check if the stream is writable

Returns
bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 210 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\IS_WRITABLE.

◆ read()

Guzzle\Stream\Stream::read (   $length)

Read data from the stream

Parameters
int$lengthUp to length number of bytes read.
Returns
string|bool Returns the data read from the stream or FALSE on failure or EOF

Implements Guzzle\Stream\StreamInterface.

Definition at line 247 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ readLine()

Guzzle\Stream\Stream::readLine (   $maxLength = null)

Read a line from the stream up to the maximum allowed buffer length

Parameters
int$maxLengthMaximum buffer length
Returns
string|bool

Implements Guzzle\Stream\StreamInterface.

Definition at line 270 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\getStream().

◆ rebuildCache()

Guzzle\Stream\Stream::rebuildCache ( )
protected

◆ rewind()

Guzzle\Stream\Stream::rewind ( )

Rewind to the beginning of the stream

Returns
bool Returns true on success or false on failure

Implements Guzzle\Stream\StreamInterface.

Reimplemented in Guzzle\Http\EntityBody.

Definition at line 265 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\seek().

◆ seek()

Guzzle\Stream\Stream::seek (   $offset,
  $whence = SEEK_SET 
)

Seek to a position in the stream

Parameters
int$offsetStream offset
int$whenceWhere the offset is applied
Returns
bool Returns TRUE on success or FALSE on failure http://www.php.net/manual/en/function.fseek.php

Implements Guzzle\Stream\StreamInterface.

Definition at line 242 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\SEEKABLE.

Referenced by Guzzle\Stream\Stream\__toString(), Guzzle\Stream\Stream\getSize(), Guzzle\Http\EntityBody\handleCompression(), and Guzzle\Stream\Stream\rewind().

◆ setCustomData()

Guzzle\Stream\Stream::setCustomData (   $key,
  $value 
)

Set custom data on the stream

Parameters
string$keyKey to set
mixed$valueValue to set
Returns
self

Implements Guzzle\Stream\StreamInterface.

Definition at line 279 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ setSize()

Guzzle\Stream\Stream::setSize (   $size)

Specify the size of the stream in bytes

Parameters
int$sizeSize of the stream contents in bytes
Returns
self

Implements Guzzle\Stream\StreamInterface.

Definition at line 235 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\$size.

◆ setStream()

Guzzle\Stream\Stream::setStream (   $stream,
  $size = null 
)

Set the stream that is wrapped by the object

Parameters
resource$streamStream resource to wrap
int$sizeSize of the stream in bytes. Only pass if the size cannot be obtained from the stream.
Returns
self

Implements Guzzle\Stream\StreamInterface.

Definition at line 137 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

References Guzzle\Stream\Stream\$size, Guzzle\Stream\Stream\$stream, and Guzzle\Stream\Stream\rebuildCache().

Referenced by Guzzle\Stream\Stream\__construct().

◆ write()

Guzzle\Stream\Stream::write (   $string)

Write data to the stream

Parameters
string$stringThe string that is to be written.
Returns
int|bool Returns the number of bytes written to the stream on success or FALSE on failure.

Implements Guzzle\Stream\StreamInterface.

Definition at line 252 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

Field Documentation

◆ $cache

array Guzzle\Stream\Stream::$cache = array()
protected

Stream cached data

Definition at line 35 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ $customData

array Guzzle\Stream\Stream::$customData = array()
protected

Custom stream data

Definition at line 41 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ $readWriteHash

Guzzle\Stream\Stream::$readWriteHash
staticprotected
Initial value:
= array(
'read' => array(
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true,
'rt' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a+' => true
),
'write' => array(
'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, 'c+' => true,
'wb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true,
'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
)
)

Definition at line 44 of file lib/vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php.

◆ $size

◆ $stream

◆ IS_LOCAL

const Guzzle\Stream\Stream::IS_LOCAL = 'is_local'

◆ IS_READABLE

◆ IS_WRITABLE

const Guzzle\Stream\Stream::IS_WRITABLE = 'is_writable'

◆ SEEKABLE

const Guzzle\Stream\Stream::SEEKABLE = 'seekable'

◆ STREAM_TYPE

const Guzzle\Stream\Stream::STREAM_TYPE = 'stream_type'

◆ WRAPPER_TYPE

const Guzzle\Stream\Stream::WRAPPER_TYPE = 'wrapper_type'

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