public static function read(string $path, int $offset = 0, int $maxLength = null) : string
    {
        $exception = null;

        try {
            $result = ErrorCatcher::run(static function() use ($path, $offset, $maxLength) {
                if ($maxLength === null) {
                    return file_get_contents($path, false, null, $offset);
                }

                return file_get_contents($path, false, null, $offset, $maxLength);
            });

            if ($result !== false) {
                return $result;
            }
        } catch (\ErrorException $e) {
            $exception = $e;
        }

        throw new IoException('Error reading from ' . $path, 0, $exception);
    }