Returns a StreamSource object, for the given URI
493644
private StreamSource getSource(String pURI)
            throws IOException, MalformedURLException {
        if (pURI != null && pURI.indexOf("://") < 0) {
            // If local, get as stream
            return new StreamSource(getResourceAsStream(pURI));
        }

        // ...else, create from URI string
        return new StreamSource(pURI);
    }
4149
@Override
    public URI getURI() throws IOException {
        URL url = getURL();
        try {
            return ResourceUtils.toURI(url);
        } catch (URISyntaxException ex) {
            throw new RuntimeException("Invalid URI [" + url + "]", ex);
        }
    }
537443
private static void streamResource(ServiceRequestContext ctx, HttpResponseWriter res,
                                       ReadableByteChannel in, long remainingBytes) {

        final int chunkSize = (int) Math.min(8192, remainingBytes);
        final ByteBuf buf = ctx.alloc().buffer(chunkSize);
        final int readBytes;
        boolean success = false;
        try {
            readBytes = read(in, buf);
            if (readBytes < 0) {
                // Should not reach here because we only read up to the end of the stream.
                // If reached, it may mean the stream has been truncated.
                throw new EOFException();
            }
            success = true;
        } catch (Exception e) {
            close(res, in, e);
            return;
        } finally {
            if (!success) {
                buf.release();
            }
        }

        final long nextRemainingBytes = remainingBytes - readBytes;
        final boolean endOfStream = nextRemainingBytes == 0;
        if (readBytes > 0) {
            if (!res.tryWrite(new ByteBufHttpData(buf, endOfStream))) {
                close(in);
                return;
            }
        } else {
            buf.release();
        }

        if (endOfStream) {
            close(res, in);
            return;
        }

        res.onDemand(() -> {
            try {
                ctx.blockingTaskExecutor().execute(() -> streamResource(ctx, res, in, nextRemainingBytes));
            } catch (Exception e) {
                close(res, in, e);
            }
        });
    }
20895
public InputStream getResourceAsStream(String uriInContext)
    {
        if (uriInContext==null || !uriInContext.startsWith("/"))
            return null;
        try
        {
            Resource resource = getHttpContext().getResource(uriInContext);
            if (resource!=null)
                return resource.getInputStream();
            
            uriInContext=URI.canonicalPath(uriInContext);
            URL url = getResource(uriInContext);
            if (url!=null)
                return url.openStream();
        }
        catch(IOException e) {LogSupport.ignore(log,e);}
        return null;
    }
347179
public static InputStream getStream(URL url) {
		Assert.notNull(url);
		try {
			return url.openStream();
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
1144933
def stream(self, url, params=None, chunk_size=64*1024):
        ''
        r = self.request(url, params=params)
        for chunk in r.iter_content(chunk_size):
            yield chunk
1142534
private static URI toURI(String encodedUrl) {
    try {
      return new URI(encodedUrl);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException(e);
    }
  }
1116535
def get_uri(self):
        """"""
        if self.source_file and os.path.exists(self.source_file.path):
            return self.source_file.path
        elif self.source_url:
            return self.source_url
        return None
1204219
def get_stream_url(self, session_id, stream_id=None):
        
        url = self.api_url + '/v2/project/' + self.api_key + '/session/' + session_id + '/stream'
        if stream_id:
            url = url + '/' + stream_id
        return url
258741
def get_content(self, uri, disable_proxy=False):
        """"""
        return self.get(uri=uri, disable_proxy=disable_proxy)
358624
def get(uri, opts = {}, &block)
      initialize_socket(uri, opts)
      HttpStream::get(uri, opts, &block)
    rescue IOError => e
      raise e unless @intentional_termination
    end
188698
def _get_resource_raw(
        self, cls, id, extra=None, headers=None, stream=False, **filters
    ):
        """"""
        headers = headers or {}
        headers.update(self.session.headers)

        postfix = "/{}".format(extra) if extra else ""
        if cls.api_root != "a":
            url = "{}/{}/{}{}".format(self.api_server, cls.collection_name, id, postfix)
        else:
            url = "{}/a/{}/{}/{}{}".format(
                self.api_server, self.app_id, cls.collection_name, id, postfix
            )

        converted_filters = convert_datetimes_to_timestamps(
            filters, cls.datetime_filter_attrs
        )
        url = str(URLObject(url).add_query_params(converted_filters.items()))
        response = self._get_http_session(cls.api_root).get(
            url, headers=headers, stream=stream
        )
        return _validate(response)
392138
def load_stream(filename):
    """"""
    rawfile = pkg_resources.resource_stream(__name__, filename)
    if six.PY2:
        return rawfile
    return io.TextIOWrapper(rawfile, 'utf-8')
1224331
def get_uris(self, base_uri, filter_list=None):
        """"""
        return {
            re.sub(r'^/', base_uri, link.attrib['href'])
            for link in self.parsedpage.get_nodes_by_selector('a')
            if 'href' in link.attrib and (
                link.attrib['href'].startswith(base_uri) or
                link.attrib['href'].startswith('/')
            ) and
            not is_uri_to_be_filtered(link.attrib['href'], filter_list)
        }
1154482
def get_uri_obj(uri, storage_args={}):
    

    if isinstance(uri, BaseURI): return uri
    uri_obj = None

    o = urlparse(uri)
    for storage in STORAGES:
        uri_obj = storage.parse_uri(o, storage_args=storage_args)
        if uri_obj is not None:
            break
    #end for
    if uri_obj is None:
        raise TypeError('<{}> is an unsupported URI.'.format(uri))

    return uri_obj
1210226
protected ByteSource stream(final String resourceId) {
        return new ByteSource() {
            @Override
            public InputStream openStream() throws IOException {
                return loader.getResource(resourceId).getInputStream();
            }
        };
    }
1006223
@VisibleForTesting
  static URI sourceURI(URI uri) {
    if (!uri.getScheme().equals("jar")) {
      return uri;
    }
    try {
      return URI.create(
          "file:/" + ((JarURLConnection) uri.toURL().openConnection()).getEntryName());
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }