public function registerStreamWrapper($protocol=null)
    {
        if ($this->registered_wrapper) {
            throw new \RuntimeException("Unregister the wrapper before registering it again!");
        }
        if ($protocol && !$this->protocol) {
            $this->protocol = $protocol; 
        }
        $this->registered_wrapper = true;
        self::$handlers[$this->protocol] = $this;
        return stream_wrapper_register($this->protocol, __CLASS__, 0);
    }