You are here

public function Stream::getSize in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/Stream.php \Zend\Diactoros\Stream::getSize()
  2. 8 vendor/guzzlehttp/psr7/src/Stream.php \GuzzleHttp\Psr7\Stream::getSize()
  3. 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Stream.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Stream::getSize()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Stream.php \Zend\Diactoros\Stream::getSize()

Get the size of the stream if known.

Return value

int|null Returns the size in bytes if known, or null if unknown.

Overrides StreamInterface::getSize

File

vendor/zendframework/zend-diactoros/src/Stream.php, line 98

Class

Stream
Implementation of PSR HTTP streams

Namespace

Zend\Diactoros

Code

public function getSize() {
  if (null === $this->resource) {
    return null;
  }
  $stats = fstat($this->resource);
  return $stats['size'];
}