public function registerStream(StreamInterface $stream, $replaceWrapper = false)
    {
        $protocol = $stream->getProtocol();
        if ($replaceWrapper === true && in_array($protocol, stream_get_wrappers())) {
            stream_wrapper_unregister($protocol);
        }

        if (stream_wrapper_register($protocol, $stream->getStreamWrapperClass())) {
            self::$streams[$protocol] = $stream;
        }

        return $this;
    }