Package gov.usgs.earthquake.product.io
Class IOUtil
java.lang.Object
gov.usgs.earthquake.product.io.IOUtil
Class with main method for converting from one product format to another.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Binary formatstatic final String
Directory formatstatic final String
Argument for input filestatic final String
Argument for input formatstatic final String
Argument for output filestatic final String
Argument for output formatstatic final String
XML formatstatic final String
Zip format -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedInputStream
Auto detect an optionally deflated stream.static ProductSource
Auto detect an Xml or Binary product source, that is optionally deflated.static ProductHandler
getProductHandler
(String outformat, File outfile) Returns a ProductHandler based on the output formatstatic ProductSource
getProductSource
(String informat, File infile) Returns a product source based on input formatstatic void
Access into IOUtil Takes arguments, gets product source and handler Streams source to handlerstatic void
CLI usage
-
Field Details
-
INFILE_ARGUMENT
Argument for input file- See Also:
-
INFORMAT_ARGUMENT
Argument for input format- See Also:
-
OUTFILE_ARGUMENT
Argument for output file- See Also:
-
OUTFORMAT_ARGUMENT
Argument for output format- See Also:
-
ZIP_FORMAT
Zip format- See Also:
-
XML_FORMAT
XML format- See Also:
-
DIRECTORY_FORMAT
Directory format- See Also:
-
BINARY_FORMAT
Binary format- See Also:
-
-
Constructor Details
-
IOUtil
public IOUtil()
-
-
Method Details
-
getProductHandler
Returns a ProductHandler based on the output format- Parameters:
outformat
- Output formatoutfile
- Output file- Returns:
- a Product Handler
- Throws:
IOException
- if IO error occurs
-
getProductSource
public static ProductSource getProductSource(String informat, File infile) throws IllegalArgumentException, IOException Returns a product source based on input format- Parameters:
informat
- input file formatinfile
- input file- Returns:
- a Productsource
- Throws:
IllegalArgumentException
- if informat argument errorIOException
- if error occurs
-
autoDetectProductSource
Auto detect an Xml or Binary product source, that is optionally deflated.- Parameters:
in
- input stream containing optionally deflated xml or binary product stream.- Returns:
- ProductSource object.
- Throws:
IOException
- if neither binary or xml product source is in stream.
-
autoDetectDeflate
Auto detect an optionally deflated stream.- Parameters:
in
- input stream containing optionally deflated xml or binary product stream.- Returns:
- ProductSource object.
- Throws:
IOException
- if neither binary or xml product source is in stream.
-
main
Access into IOUtil Takes arguments, gets product source and handler Streams source to handler- Parameters:
args
- CLI args for infile, informat, outfile, outformat- Throws:
Exception
- if error occurs
-
printUsage
public static void printUsage()CLI usage
-