2 namespace TYPO3\CMS\Core\Http;
53 $this->resource = fopen(
$stream, $mode);
55 throw new \InvalidArgumentException(
'Invalid stream provided; must be a string stream identifier or resource', 1436717284);
81 }
catch (\RuntimeException $e) {
93 if (!$this->resource) {
110 $this->resource = null;
121 if ($this->resource === null) {
124 $stats = fstat($this->resource);
125 return $stats[
'size'];
136 if (!$this->resource) {
137 throw new \RuntimeException(
'No resource available; cannot tell position', 1436717285);
139 $result = ftell($this->resource);
140 if (!is_int($result)) {
141 throw new \RuntimeException(
'Error occurred during tell operation', 1436717286);
153 if (!$this->resource) {
156 return feof($this->resource);
166 if (!$this->resource) {
186 public function seek($offset, $whence = SEEK_SET)
188 if (!$this->resource) {
189 throw new \RuntimeException(
'No resource available; cannot seek position', 1436717287);
193 throw new \RuntimeException(
'Stream is not seekable', 1436717288);
195 $result = fseek($this->resource, $offset, $whence);
197 throw new \RuntimeException(
'Error seeking within stream', 1436717289);
223 if (!$this->resource) {
227 return is_writable($uri);
239 if (!$this->resource) {
240 throw new \RuntimeException(
'No resource available; cannot write', 1436717290);
242 $result = fwrite($this->resource, $string);
243 if ($result ===
false) {
244 throw new \RuntimeException(
'Error writing to stream', 1436717291);
256 if (!$this->resource) {
260 return (strpos($mode,
'r') !==
false || strpos($mode,
'+') !==
false);
275 if (!$this->resource) {
276 throw new \RuntimeException(
'No resource available; cannot read', 1436717292);
279 throw new \RuntimeException(
'Stream is not readable', 1436717293);
281 $result = fread($this->resource, $length);
282 if ($result ===
false) {
283 throw new \RuntimeException(
'Error reading stream', 1436717294);
300 $result = stream_get_contents($this->resource);
301 if ($result ===
false) {
302 throw new \RuntimeException(
'Error reading from stream', 1436717295);
323 $metadata = stream_get_meta_data($this->resource);
327 if (!isset($metadata[$key])) {
330 return $metadata[$key];
345 set_error_handler(
function ($e) use (&$error) {
349 restore_error_handler();
352 throw new \InvalidArgumentException(
'Invalid stream reference provided', 1436717296);
355 throw new \InvalidArgumentException(
'Invalid stream provided; must be a string stream identifier or resource', 1436717297);