Package htsjdk.tribble.util
Class HTTPHelper
- java.lang.Object
-
- htsjdk.tribble.util.HTTPHelper
-
-
Constructor Summary
Constructors Constructor Description HTTPHelper(URL url)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
exists()
long
getContentLength()
URL
getUrl()
InputStream
openInputStream()
Open an InputStream to stream the contents of the resourceInputStream
openInputStreamForRange(long start, long end)
Open an InputStream to stream a slice (range) of the resource.static void
setProxy(Proxy p)
-
-
-
Constructor Detail
-
HTTPHelper
public HTTPHelper(URL url)
-
-
Method Detail
-
setProxy
public static void setProxy(Proxy p)
-
getUrl
public URL getUrl()
-
getContentLength
public long getContentLength() throws IOException
- Specified by:
getContentLength
in interfaceURLHelper
- 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 interfaceURLHelper
- 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 interfaceURLHelper
- Parameters:
start
- start of range in bytesend
- end of range ni bytes- Returns:
- Throws:
IOException
-
exists
public boolean exists() throws IOException
- Specified by:
exists
in interfaceURLHelper
- Throws:
IOException
-
-