Package com.norconex.commons.lang.url
Class URLStreamer
- java.lang.Object
-
- com.norconex.commons.lang.url.URLStreamer
-
public final class URLStreamer extends Object
Provides a quick and easy way to stream a URL.- Author:
- Pascal Essiembre
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
URLStreamer.HttpHost
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InputStream
stream(HttpURL url)
Streams URL content.static InputStream
stream(HttpURL url, Credentials creds)
Streams URL content.static InputStream
stream(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content.static InputStream
stream(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content.static InputStream
stream(String url)
Streams URL content.static InputStream
stream(String url, Credentials creds)
Streams URL content.static InputStream
stream(String url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content.static InputStream
stream(String url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content.static InputStream
stream(URL url)
Streams URL content.static InputStream
stream(URL url, Credentials creds)
Streams URL content.static InputStream
stream(URL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content.static InputStream
stream(URL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content.static String
streamToString(HttpURL url)
Streams URL content to a String.static String
streamToString(HttpURL url, Credentials creds)
Streams URL content to a String.static String
streamToString(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content to a String.static String
streamToString(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content to a String.static String
streamToString(String url)
Streams URL content to a String.static String
streamToString(String url, Credentials creds)
Streams URL content to a String.static String
streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content to a String using UTF-8 character encoding.static String
streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content to a String using UTF-8 character encoding.static String
streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds, String charEncoding)
Streams URL content to a String.static String
streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy, String charEncoding)
Streams URL content to a String.static String
streamToString(URL url)
Streams URL content to a String.static String
streamToString(URL url, Credentials creds)
Streams URL content to a String.static String
streamToString(URL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content to a String.static String
streamToString(URL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content to a String.
-
-
-
Method Detail
-
stream
public static InputStream stream(String url)
Streams URL content.- Parameters:
url
- the URL to stream- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(URL url)
Streams URL content.- Parameters:
url
- the URL to stream- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(HttpURL url)
Streams URL content.- Parameters:
url
- the URL to stream- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(String url, Credentials creds)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URL- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(URL url, Credentials creds)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URL- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(HttpURL url, Credentials creds)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URL- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(String url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URL- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(URL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URL- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URL- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(String url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxy- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(URL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxy- Returns:
- a URL content InputStream
-
stream
public static InputStream stream(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxy- Returns:
- a URL content InputStream
-
streamToString
public static String streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content to a String using UTF-8 character encoding.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URL- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy, String charEncoding)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLcharEncoding
- character encoding- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(URL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URL- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URL- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content to a String using UTF-8 character encoding.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxy- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(String url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds, String charEncoding)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxycharEncoding
- character encoding- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(URL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxy- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(HttpURL url, Credentials creds, URLStreamer.HttpHost proxy, Credentials proxyCreds)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URLproxy
- proxy to use to stream the URLproxyCreds
- credentials to access the proxy- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(String url, Credentials creds)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URL- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(URL url, Credentials creds)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URL- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(HttpURL url, Credentials creds)
Streams URL content to a String.- Parameters:
url
- the URL to streamcreds
- credentials for a protected URL- Returns:
- a URL content as a String
-
streamToString
public static String streamToString(String url)
Streams URL content to a String.- Parameters:
url
- the URL to stream- Returns:
- a URL content as a String
- Since:
- 1.3
-
streamToString
public static String streamToString(URL url)
Streams URL content to a String.- Parameters:
url
- the URL to stream- Returns:
- a URL content as a String
- Since:
- 1.3
-
-