Package gov.usgs.earthquake.product.io
Class ZipProductHandler
java.lang.Object
gov.usgs.earthquake.product.io.ObjectProductHandler
gov.usgs.earthquake.product.io.ZipProductHandler
- All Implemented Interfaces:
ProductHandler
Store a product to an OutputStream using ZIP.
Accumulates entire product the same as ObjectProductOutput, then onEndProduct
outputs a zip file containing "product.xml" as the first entry and all
product content as other entries.
Because the zip file is not written until after all content has been
"received", all product content may result in in-memory buffering. This is
not the case when dealing with File-backed products. If this is a concern,
users are encouraged to use the Xml Input and Output classes, which always
use streams and never buffer content.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The entry filename used for product metadata. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new ZipProductHandler object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Free any resources associated with this handler.void
Creates and outputs the zip stream.Methods inherited from class gov.usgs.earthquake.product.io.ObjectProductHandler
getProduct, getProduct, onBeginProduct, onContent, onLink, onProperty, onSignature, onSignatureHistory, onSignatureVersion
-
Field Details
-
PRODUCT_XML_ZIP_ENTRYNAME
The entry filename used for product metadata.- See Also:
-
-
Constructor Details
-
ZipProductHandler
Construct a new ZipProductHandler object.- Parameters:
out
- the output stream where zip content is written.
-
-
Method Details
-
onEndProduct
Creates and outputs the zip stream.- Specified by:
onEndProduct
in interfaceProductHandler
- Overrides:
onEndProduct
in classObjectProductHandler
- Parameters:
id
- which product.- Throws:
Exception
- if error occurs
-
close
public void close()Free any resources associated with this handler.- Specified by:
close
in interfaceProductHandler
- Overrides:
close
in classObjectProductHandler
-