Package gov.usgs.earthquake.product
Class URLContent
- java.lang.Object
-
- gov.usgs.earthquake.product.AbstractContent
-
- gov.usgs.earthquake.product.URLContent
-
- All Implemented Interfaces:
Content
public class URLContent extends AbstractContent
Content stored at a URL.
-
-
Constructor Summary
Constructors Constructor Description URLContent(FileContent fc)
Create a new URLContent object from a FileContent.URLContent(java.net.URL content)
Create a new URLContent object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Free any resources associated with this content.java.io.InputStream
getInputStream()
The content bytes as a stream.java.net.URL
getURL()
-
Methods inherited from class gov.usgs.earthquake.product.AbstractContent
getContentType, getLastModified, getLength, getSha256, getSha256, setContentType, setLastModified, setLength, setSha256
-
-
-
-
Constructor Detail
-
URLContent
public URLContent(java.net.URL content) throws java.net.URISyntaxException
Create a new URLContent object.- Parameters:
content
- the content available at a URL.- Throws:
java.net.URISyntaxException
- on URI error
-
URLContent
public URLContent(FileContent fc) throws java.net.MalformedURLException
Create a new URLContent object from a FileContent.- Parameters:
fc
- the file content.- Throws:
java.net.MalformedURLException
- if URL error
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
Description copied from interface:Content
The content bytes as a stream.- Returns:
- an InputStream for the wrapped content.
- Throws:
java.io.IOException
- on IO error
-
getURL
public java.net.URL getURL()
- Returns:
- the wrapped url.
-
close
public void close()
Free any resources associated with this content.
-
-