Package htsjdk.tribble.util

# Class HTTPHelper

java.lang.Object
htsjdk.tribble.util.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 Summary

Constructors
Constructor
Description
`HTTPHelper(URL url)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`exists()`
`long`
`getContentLength()`
`URL`
`getUrl()`
`InputStream`
`openInputStream()`
Open an InputStream to stream the contents of the resource
`InputStream`
`openInputStreamForRange(long start, long end)`
Open an InputStream to stream a slice (range) of the resource.
`static void`
`setProxy(Proxy p)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HTTPHelper

public HTTPHelper(URL url)

## Method Details

### setProxy

public static void setProxy(Proxy p)

### getUrl

public URL getUrl()

Specified by:
  `getUrl` in interface `URLHelper`
Returns:
  URL of the associated resource

### getContentLength

public long getContentLength() throws IOException

Specified by:
  `getContentLength` in interface `URLHelper`
Returns:
  content length of the resource, or -1 if not available
Throws:
  `IOException`

### openInputStream

public InputStream openInputStream() throws IOException
Description copied from interface: `URLHelper`
Open an InputStream to stream the contents of the resource

Specified by:
  `openInputStream` in interface `URLHelper`
Returns:
Throws:
  `IOException`

### 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`

### exists

public boolean exists() throws IOException

Specified by:
  `exists` in interface `URLHelper`
Throws:
  `IOException`