public function stream_seek($offset, $whence) { return $this->stream->seek($offset, $whence); }
/** * Calculate a hash of a Stream * * @param puzzle_stream_StreamInterface $stream Stream to calculate the hash for * @param string $algo Hash algorithm (e.g. md5, crc32, etc) * @param bool $rawOutput Whether or not to use raw output * * @return string Returns the hash of the stream * @throws puzzle_stream_exception_SeekException */ public static function hash(puzzle_stream_StreamInterface $stream, $algo, $rawOutput = false) { $pos = $stream->tell(); if ($pos > 0 && !$stream->seek(0)) { throw new puzzle_stream_exception_SeekException($stream); } $ctx = hash_init($algo); while (!$stream->eof()) { hash_update($ctx, $stream->read(1048576)); } $out = hash_final($ctx, (bool) $rawOutput); $stream->seek($pos); return $out; }
/** * {@inheritdoc} */ public function seek($offset, $whence = SEEK_SET) { return $this->_delegate->seek($offset, $whence); }