Class URLImageSource
- java.lang.Object
-
- net.coobird.thumbnailator.tasks.io.AbstractImageSource<java.net.URL>
-
- net.coobird.thumbnailator.tasks.io.URLImageSource
-
- All Implemented Interfaces:
ImageSource<java.net.URL>
public class URLImageSource extends AbstractImageSource<java.net.URL>
AnImageSourcewhich retrieves a source image from a URL.
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.ProxyproxyThe proxy to use to connect to the image URL.private java.net.URLurlThe URL from which to retrieve the source image.-
Fields inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSource
hasReadInput, inputFormatName, param
-
-
Constructor Summary
Constructors Constructor Description URLImageSource(java.lang.String url)Instantiates anURLImageSourcewith the URL from which the source image should be retrieved from.URLImageSource(java.lang.String url, java.net.Proxy proxy)Instantiates anURLImageSourcewith the URL from which the source image should be retrieved from, along with the proxy to use to connect to the aforementioned URL.URLImageSource(java.net.URL url)Instantiates anURLImageSourcewith the URL from which the source image should be retrieved from.URLImageSource(java.net.URL url, java.net.Proxy proxy)Instantiates anURLImageSourcewith the URL from which the source image should be retrieved from, along with the proxy to use to connect to the aforementioned URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.ProxygetProxy()Returns the proxy to use when connecting to the URL to retrieve the source image.java.net.URLgetSource()Returns the URL from which the source image is retrieved from.java.awt.image.BufferedImageread()Retrieves the image from the source.-
Methods inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSource
finishedReading, getInputFormatName, setThumbnailParameter
-
-
-
-
Constructor Detail
-
URLImageSource
public URLImageSource(java.net.URL url)
Instantiates anURLImageSourcewith the URL from which the source image should be retrieved from.- Parameters:
url- URL to the source image.- Throws:
java.lang.NullPointerException- If the URL is null
-
URLImageSource
public URLImageSource(java.lang.String url) throws java.net.MalformedURLExceptionInstantiates anURLImageSourcewith the URL from which the source image should be retrieved from.- Parameters:
url- URL to the source image.- Throws:
java.lang.NullPointerException- If the URL is nulljava.net.MalformedURLException- If the URL is not valid.
-
URLImageSource
public URLImageSource(java.net.URL url, java.net.Proxy proxy)Instantiates anURLImageSourcewith the URL from which the source image should be retrieved from, along with the proxy to use to connect to the aforementioned URL.- Parameters:
url- URL to the source image.proxy- Proxy to use to connect to the URL.- Throws:
java.lang.NullPointerException- If the URL and or the proxy is null
-
URLImageSource
public URLImageSource(java.lang.String url, java.net.Proxy proxy) throws java.net.MalformedURLExceptionInstantiates anURLImageSourcewith the URL from which the source image should be retrieved from, along with the proxy to use to connect to the aforementioned URL.- Parameters:
url- URL to the source image.proxy- Proxy to use to connect to the URL.- Throws:
java.lang.NullPointerException- If the URL and or the proxy is nulljava.net.MalformedURLException- If the URL is not valid.
-
-
Method Detail
-
read
public java.awt.image.BufferedImage read() throws java.io.IOExceptionDescription copied from interface:ImageSourceRetrieves the image from the source.- Returns:
- The image.
- Throws:
java.io.IOException- When a problem occurs while reading or obtaining the image.
-
getSource
public java.net.URL getSource()
Returns the URL from which the source image is retrieved from.- Returns:
- the url The URL to the source image.s
-
getProxy
public java.net.Proxy getProxy()
Returns the proxy to use when connecting to the URL to retrieve the source image.- Returns:
- the proxy The proxy used to connect to a URL.
-
-