OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
google
/
cloud-storage
/
src
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/12/2024 10:33:51 AM
rwxr-xr-x
📄
Acl.php
7.48 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
Bucket.php
70.1 KB
08/12/2024 10:33:13 AM
rw-r--r--
📁
Connection
-
08/12/2024 10:34:59 AM
rwxr-xr-x
📄
CreatedHmacKey.php
1.97 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
EncryptionTrait.php
5.15 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
HmacKey.php
5.15 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
Lifecycle.php
18.92 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
Notification.php
5.93 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
ObjectIterator.php
1.21 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
ObjectPageIterator.php
1.93 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
ReadStream.php
2.82 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
SigningHelper.php
30.55 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
StorageClient.php
25.22 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
StorageObject.php
56.04 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
StreamWrapper.php
26.31 KB
08/12/2024 10:33:13 AM
rw-r--r--
📄
WriteStream.php
3.37 KB
08/12/2024 10:33:13 AM
rw-r--r--
Editing: ReadStream.php
Close
<?php /** * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Google\Cloud\Storage; use GuzzleHttp\Psr7\StreamDecoratorTrait; use Psr\Http\Message\StreamInterface; /** * A Stream implementation that wraps a GuzzleHttp download stream to * provide `getSize()` from the response headers. */ class ReadStream implements StreamInterface { use StreamDecoratorTrait; private $stream; /** * Create a new ReadStream. * * @param StreamInterface $stream The stream interface to wrap */ public function __construct(StreamInterface $stream) { $this->stream = $stream; } /** * Return the full size of the buffer. If the underlying stream does * not report it's size, try to fetch the size from the Content-Length * response header. * * @return int The size of the stream. */ public function getSize(): ?int { return $this->stream->getSize() ?: $this->getSizeFromMetadata(); } /** * Attempt to fetch the size from the Content-Length response header. * If we cannot, return 0. * * @return int The Size of the stream */ private function getSizeFromMetadata(): int { foreach ($this->stream->getMetadata('wrapper_data') as $value) { if (substr($value, 0, 15) == "Content-Length:") { return (int) substr($value, 16); } } return 0; } /** * Read bytes from the underlying buffer, retrying until we have read * enough bytes or we cannot read any more. We do this because the * internal C code for filling a buffer does not account for when * we try to read large chunks from a user-land stream that does not * return enough bytes. * * @param int $length The number of bytes to read. * @return string Read bytes from the underlying stream. */ public function read($length): string { $data = ''; do { $moreData = $this->stream->read($length); $data .= $moreData; $readLength = strlen($moreData); $length -= $readLength; } while ($length > 0 && $readLength > 0); return $data; } }