Reference documentation and code samples for the Cloud Storage Client class HashValidatingStream.
A Guzzle stream decorator that computes CRC32C and MD5 hashes on the fly and validates them when the end of the stream is reached.
Namespace
Google \ Cloud \ StorageMethods
__construct
| Parameters | |
|---|---|
| Name | Description |
stream |
Psr\Http\Message\StreamInterface
The underlying stream to wrap. |
options |
array
Configuration options. |
↳ expectedCrc32c |
string
Base64-encoded expected CRC32C checksum. |
↳ expectedMd5 |
string
Base64-encoded expected MD5 checksum. |
isSeekable
Validating streams are not seekable since hash calculations are done on-the-fly.
| Returns | |
|---|---|
| Type | Description |
bool |
|
seek
Seek operations are not supported on validating streams.
| Parameters | |
|---|---|
| Name | Description |
offset |
int
|
whence |
int
|
read
Read from the stream and update hash calculations.
| Parameter | |
|---|---|
| Name | Description |
length |
int
|
| Returns | |
|---|---|
| Type | Description |
string |
|
getContents
Get the entire remaining contents of the stream and validate.
| Returns | |
|---|---|
| Type | Description |
string |
|