public function resolveReader(ResourceUri $resource)
    {
        if (! array_key_exists($resource->getProtocol(), $this->protocolFactoryIndexes)) {
            throw new \RuntimeException('Unsupported protocol: ' . $resource->getProtocol() . '( ' . $resource  . ')');
        }

        /** @var int $factoryIndex */
        $factoryIndex = $this->protocolFactoryIndexes[$resource->getProtocol()];
        /** @var ResourceReaderFactory $factory */
        $factory = $this->factories[$factoryIndex];

        return $factory->createReaderFor($resource);
    }