Package gov.usgs.earthquake.product
Class InputStreamContent
java.lang.Object
gov.usgs.earthquake.product.AbstractContent
gov.usgs.earthquake.product.InputStreamContent
- All Implemented Interfaces:
Content
Content within an InputStream.
-
Constructor Summary
ConstructorsConstructorDescriptionInputStreamContent
(Content content) Create an InputStreamContent from another Content.InputStreamContent
(InputStream content) Create a new InputStream content. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Free any resources associated with this content.The content bytes as a stream.InputStream can only be read once.Methods inherited from class gov.usgs.earthquake.product.AbstractContent
getContentType, getLastModified, getLength, getSha256, setContentType, setLastModified, setLength, setSha256
-
Constructor Details
-
InputStreamContent
Create a new InputStream content.- Parameters:
content
- the content.
-
InputStreamContent
Create an InputStreamContent from another Content.- Parameters:
content
- the content to duplicate.- Throws:
IOException
- if IO error occurs
-
-
Method Details
-
getInputStream
Description copied from interface:Content
The content bytes as a stream.- Returns:
- InputStream to content.
- Throws:
IOException
- if an error occurs while creating the stream.
-
getSha256
InputStream can only be read once.If sha256 is null, read and convert to in memory stream.
- Specified by:
getSha256
in interfaceContent
- Overrides:
getSha256
in classAbstractContent
- Returns:
- base64 encoded sha256 of content bytes.
- Throws:
Exception
- if error occurs
-
close
public void close()Free any resources associated with this content.
-