public function tell(): int
    {
        if (null === $this->handle) {
            throw new \LogicException('Can not read from closed input stream.');
        }

        $position = @ftell($this->handle);
        if (false === $position) {
            throw new StreamException(
                    'Can not read current position in file: '
                    . lastErrorMessage('unknown error')
            );
        }

        return $position;
    }