Class URLImageSource

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.net.Proxy proxy
      The proxy to use to connect to the image URL.
      private java.net.URL url
      The URL from which to retrieve the source image.
    • Constructor Summary

      Constructors 
      Constructor Description
      URLImageSource​(java.lang.String url)
      Instantiates an URLImageSource with the URL from which the source image should be retrieved from.
      URLImageSource​(java.lang.String url, java.net.Proxy proxy)
      Instantiates an URLImageSource with 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 an URLImageSource with the URL from which the source image should be retrieved from.
      URLImageSource​(java.net.URL url, java.net.Proxy proxy)
      Instantiates an URLImageSource with 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.Proxy getProxy()
      Returns the proxy to use when connecting to the URL to retrieve the source image.
      java.net.URL getSource()
      Returns the URL from which the source image is retrieved from.
      java.awt.image.BufferedImage read()
      Retrieves the image from the source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • url

        private final java.net.URL url
        The URL from which to retrieve the source image.
      • proxy

        private final java.net.Proxy proxy
        The proxy to use to connect to the image URL.

        If a proxy is not required, then this field will be null.

    • Constructor Detail

      • URLImageSource

        public URLImageSource​(java.net.URL url)
        Instantiates an URLImageSource with 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.MalformedURLException
        Instantiates an URLImageSource with 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
        java.net.MalformedURLException - If the URL is not valid.
      • URLImageSource

        public URLImageSource​(java.net.URL url,
                              java.net.Proxy proxy)
        Instantiates an URLImageSource with 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.MalformedURLException
        Instantiates an URLImageSource with 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
        java.net.MalformedURLException - If the URL is not valid.
    • Method Detail

      • read

        public java.awt.image.BufferedImage read()
                                          throws java.io.IOException
        Description copied from interface: ImageSource
        Retrieves 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.