Class IOUtil

java.lang.Object
gov.usgs.earthquake.product.io.IOUtil

public class IOUtil extends Object
Class with main method for converting from one product format to another.
  • Field Details

  • Constructor Details

    • IOUtil

      public IOUtil()
  • Method Details

    • getProductHandler

      public static ProductHandler getProductHandler(String outformat, File outfile) throws IOException
      Returns a ProductHandler based on the output format
      Parameters:
      outformat - Output format
      outfile - 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 format
      infile - input file
      Returns:
      a Productsource
      Throws:
      IllegalArgumentException - if informat argument error
      IOException - if error occurs
    • autoDetectProductSource

      public static ProductSource autoDetectProductSource(InputStream in) throws IOException
      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

      public static BufferedInputStream autoDetectDeflate(InputStream in) throws IOException
      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

      public static void main(String[] args) throws Exception
      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