Class HTTPHelper

  • All Implemented Interfaces:
    URLHelper

    public class HTTPHelper
    extends Object
    implements URLHelper
    Simple implementation of URLHelper based on the JDK URL and HttpURLConnection classes. This version optionally takes a proxy, but does not support authentication.
    • Constructor Detail

      • HTTPHelper

        public HTTPHelper​(URL url)
    • Method Detail

      • setProxy

        public static void setProxy​(Proxy p)
      • getUrl

        public URL getUrl()
        Specified by:
        getUrl in interface URLHelper
        Returns:
        URL of the associated resource
      • openInputStreamForRange

        public InputStream openInputStreamForRange​(long start,
                                                   long end)
                                            throws IOException
        Open an InputStream to stream a slice (range) of the resource. The host server must support range byte requests and return a 206 response code (partial response). If it does not an IOException will be thrown. Its the client's responsibility to close the stream.
        Specified by:
        openInputStreamForRange in interface URLHelper
        Parameters:
        start - start of range in bytes
        end - end of range ni bytes
        Returns:
        Throws:
        IOException