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
public class ZipProductHandler extends ObjectProductHandler
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
Fields Modifier and Type Field Description static java.lang.String
PRODUCT_XML_ZIP_ENTRYNAME
The entry filename used for product metadata.
-
Constructor Summary
Constructors Constructor Description ZipProductHandler(java.io.OutputStream out)
Construct a new ZipProductHandler object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Free any resources associated with this handler.void
onEndProduct(ProductId id)
Creates and outputs the zip stream.-
Methods inherited from class gov.usgs.earthquake.product.io.ObjectProductHandler
getProduct, getProduct, onBeginProduct, onContent, onLink, onProperty, onSignature, onSignatureVersion
-
-
-
-
Field Detail
-
PRODUCT_XML_ZIP_ENTRYNAME
public static final java.lang.String PRODUCT_XML_ZIP_ENTRYNAME
The entry filename used for product metadata.- See Also:
- Constant Field Values
-
-
Method Detail
-
onEndProduct
public void onEndProduct(ProductId id) throws java.lang.Exception
Creates and outputs the zip stream.- Specified by:
onEndProduct
in interfaceProductHandler
- Overrides:
onEndProduct
in classObjectProductHandler
- Parameters:
id
- which product.- Throws:
java.lang.Exception
- if error occurs
-
close
public void close()
Free any resources associated with this handler.- Specified by:
close
in interfaceProductHandler
- Overrides:
close
in classObjectProductHandler
-
-