Class HashingStream
- Aws\HashingStream implements Psr\Http\Message\StreamInterface uses GuzzleHttp\Psr7\StreamDecoratorTrait
- Namespace: Aws
- Located at HashingStream.php
Stream decorator that calculates a rolling hash of the stream as it is read.
Methods Summary
- __construct ( Psr\Http\Message\StreamInterface $stream, Aws\HashInterface $hash, callable $onComplete = null )
-
read ( int $length )
Read data from the stream.
-
seek ( int $offset, int $whence = SEEK_SET )
Seek to a position in the stream.
Methods inherited from Psr\Http\Message\StreamInterface
__toString()
,
close()
,
detach()
,
eof()
,
getContents()
,
getMetadata()
,
getSize()
,
isReadable()
,
isSeekable()
,
isWritable()
,
rewind()
,
tell()
,
write()
Methods used from GuzzleHttp\Psr7\StreamDecoratorTrait
Methods Details
__construct (
Psr\Http\Message\StreamInterface
$stream,
Aws\HashInterface
$hash,
callable
$onComplete = null
)
Parameters
Psr\Http\Message\StreamInterface |
$stream | Stream that is being read. |
Aws\HashInterface |
$hash | Hash used to calculate checksum. |
callable | $onComplete = null | Optional function invoked when the hash calculation is completed. |
string read ( integer $length )
Read data from the stream.
Parameters
integer | $length | Read 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
RuntimeException if an error occurs. |
Implementation of
seek ( integer $offset, integer $whence = SEEK_SET )
Seek to a position in the stream.
Parameters
integer | $offset | Stream offset |
integer | $whence = SEEK_SET | Specifies how the cursor position will be calculated
based on the seek offset. Valid values are identical to the built-in
PHP $whence values for |
Exceptions
RuntimeException on failure. |