Open Journal Systems  3.3.0
Guzzle\Http\CachingEntityBody Class Reference
Inheritance diagram for Guzzle\Http\CachingEntityBody:
Guzzle\Http\AbstractEntityBodyDecorator Guzzle\Http\EntityBodyInterface Guzzle\Stream\StreamInterface

Public Member Functions

 __construct (EntityBodyInterface $body)
 
 __toString ()
 
 close ()
 
 getContentEncoding ()
 
 getContentType ()
 
 getCustomData ($key)
 
 getMetaData ($key=null)
 
 getSize ()
 
 getStream ()
 
 getStreamType ()
 
 getUri ()
 
 getWrapper ()
 
 getWrapperData ()
 
 isConsumed ()
 
 read ($length)
 
 readLine ($maxLength=null)
 
 rewind ()
 
 seek ($offset, $whence=SEEK_SET)
 
 setCustomData ($key, $value)
 
 setRewindFunction ($callable)
 
 setStream ($stream, $size=0)
 
 write ($string)
 
- Public Member Functions inherited from Guzzle\Http\AbstractEntityBodyDecorator
 __call ($method, array $args)
 
 compress ($filter='zlib.deflate')
 
 detachStream ()
 
 feof ()
 
 ftell ()
 
 getContentLength ()
 
 getContentMd5 ($rawOutput=false, $base64Encode=false)
 
 isLocal ()
 
 isReadable ()
 
 isRepeatable ()
 
 isSeekable ()
 
 isWritable ()
 
 setSize ($size)
 
 uncompress ($filter='zlib.inflate')
 

Protected Attributes

 $remoteStream
 
 $skipReadBytes = 0
 
- Protected Attributes inherited from Guzzle\Http\AbstractEntityBodyDecorator
 $body
 

Detailed Description

EntityBody decorator that can cache previously read bytes from a sequentially read tstream

Definition at line 10 of file CachingEntityBody.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Http\CachingEntityBody::__construct ( EntityBodyInterface  $body)

We will treat the buffer object as the body of the entity body {

Parameters
EntityBodyInterface$bodyEntity body to decorate
}

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 28 of file CachingEntityBody.php.

References Guzzle\Http\AbstractEntityBodyDecorator\$body.

Member Function Documentation

◆ __toString()

Guzzle\Http\CachingEntityBody::__toString ( )

Will give the contents of the buffer followed by the exhausted remote stream.

Warning: Loads the entire stream into memory

Returns
string

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 41 of file CachingEntityBody.php.

References Guzzle\Http\AbstractEntityBodyDecorator\ftell(), Guzzle\Http\CachingEntityBody\isConsumed(), Guzzle\Http\CachingEntityBody\read(), Guzzle\Http\CachingEntityBody\rewind(), and Guzzle\Http\CachingEntityBody\seek().

◆ close()

Guzzle\Http\CachingEntityBody::close ( )

Close both the remote stream and buffer stream

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 166 of file CachingEntityBody.php.

◆ getContentEncoding()

Guzzle\Http\CachingEntityBody::getContentEncoding ( )

Get the Content-Encoding of the EntityBody

Returns
bool|string

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 181 of file CachingEntityBody.php.

◆ getContentType()

Guzzle\Http\CachingEntityBody::getContentType ( )

Guess the Content-Type of a local stream

Returns
string|null
See also
http://www.php.net/manual/en/function.finfo-open.php

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 176 of file CachingEntityBody.php.

◆ getCustomData()

Guzzle\Http\CachingEntityBody::getCustomData (   $key)

Always retrieve custom data from the remote stream {Get custom data from the stream

Parameters
string$keyKey to retrieve
Returns
null|mixed
}

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 220 of file CachingEntityBody.php.

◆ getMetaData()

Guzzle\Http\CachingEntityBody::getMetaData (   $key = null)

Get stream metadata

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

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 186 of file CachingEntityBody.php.

◆ getSize()

Guzzle\Http\CachingEntityBody::getSize ( )

Get the size of the stream if able

Returns
int|bool

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 56 of file CachingEntityBody.php.

◆ getStream()

Guzzle\Http\CachingEntityBody::getStream ( )

Get the stream resource

Returns
resource

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 191 of file CachingEntityBody.php.

◆ getStreamType()

Guzzle\Http\CachingEntityBody::getStreamType ( )

Get a label describing the underlying implementation of the stream

Returns
string

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 206 of file CachingEntityBody.php.

◆ getUri()

Guzzle\Http\CachingEntityBody::getUri ( )

Get the URI/filename associated with this stream

Returns
string

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 211 of file CachingEntityBody.php.

◆ getWrapper()

Guzzle\Http\CachingEntityBody::getWrapper ( )

Get the stream wrapper type

Returns
string

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 196 of file CachingEntityBody.php.

◆ getWrapperData()

Guzzle\Http\CachingEntityBody::getWrapperData ( )

Wrapper specific data attached to this stream.

Returns
array

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 201 of file CachingEntityBody.php.

◆ isConsumed()

Guzzle\Http\CachingEntityBody::isConsumed ( )

Check if the stream has been consumed

Returns
bool

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 158 of file CachingEntityBody.php.

Referenced by Guzzle\Http\CachingEntityBody\__toString(), and Guzzle\Http\CachingEntityBody\readLine().

◆ read()

Guzzle\Http\CachingEntityBody::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

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 100 of file CachingEntityBody.php.

Referenced by Guzzle\Http\CachingEntityBody\__toString(), and Guzzle\Http\CachingEntityBody\readLine().

◆ readLine()

Guzzle\Http\CachingEntityBody::readLine (   $maxLength = null)

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

Parameters
int$maxLengthMaximum buffer length
Returns
string|bool
} http://php.net/manual/en/function.fgets.php

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 142 of file CachingEntityBody.php.

References Guzzle\Http\CachingEntityBody\isConsumed(), and Guzzle\Http\CachingEntityBody\read().

◆ rewind()

Guzzle\Http\CachingEntityBody::rewind ( )

Rewind to the beginning of the stream

Returns
bool Returns true on success or false on failure

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 85 of file CachingEntityBody.php.

References Guzzle\Http\CachingEntityBody\seek().

Referenced by Guzzle\Http\CachingEntityBody\__toString().

◆ seek()

Guzzle\Http\CachingEntityBody::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
}

Exceptions
RuntimeExceptionWhen seeking with SEEK_END or when seeking past the total size of the buffer stream

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 65 of file CachingEntityBody.php.

References Guzzle\Http\AbstractEntityBodyDecorator\ftell().

Referenced by Guzzle\Http\CachingEntityBody\__toString(), and Guzzle\Http\CachingEntityBody\rewind().

◆ setCustomData()

Guzzle\Http\CachingEntityBody::setCustomData (   $key,
  $value 
)

Always set custom data on the remote stream {Set custom data on the stream

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

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 229 of file CachingEntityBody.php.

◆ setRewindFunction()

Guzzle\Http\CachingEntityBody::setRewindFunction (   $callable)

Does not support custom rewind functions

Exceptions
RuntimeException

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 95 of file CachingEntityBody.php.

◆ setStream()

Guzzle\Http\CachingEntityBody::setStream (   $stream,
  $size = 0 
)

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

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 171 of file CachingEntityBody.php.

◆ write()

Guzzle\Http\CachingEntityBody::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.

Reimplemented from Guzzle\Http\AbstractEntityBodyDecorator.

Definition at line 126 of file CachingEntityBody.php.

References Guzzle\Http\AbstractEntityBodyDecorator\ftell().

Field Documentation

◆ $remoteStream

EntityBody Guzzle\Http\CachingEntityBody::$remoteStream
protected

Remote stream used to actually pull data onto the buffer

Definition at line 16 of file CachingEntityBody.php.

◆ $skipReadBytes

int Guzzle\Http\CachingEntityBody::$skipReadBytes = 0
protected

The number of bytes to skip reading due to a write on the temporary buffer

Definition at line 22 of file CachingEntityBody.php.


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