public function getContents()
    {
        if (self::SCHEME_RESOURCE === $this->getScheme()) {
            $contents = '';
            while ($data = fread($this->stream, 2048)) {
                $contents .= $data;
            }
        } else {
            $contents = file_get_contents($this->uri);
        }
        return $contents;
    }