Class IOUtil


  • public class IOUtil
    extends java.lang.Object
    Class with main method for converting from one product format to another.
    • Constructor Summary

      Constructors 
      Constructor Description
      IOUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.io.BufferedInputStream autoDetectDeflate​(java.io.InputStream in)
      Auto detect an optionally deflated stream.
      static ProductSource autoDetectProductSource​(java.io.InputStream in)
      Auto detect an Xml or Binary product source, that is optionally deflated.
      static ProductHandler getProductHandler​(java.lang.String outformat, java.io.File outfile)
      Returns a ProductHandler based on the output format
      static ProductSource getProductSource​(java.lang.String informat, java.io.File infile)
      Returns a product source based on input format
      static void main​(java.lang.String[] args)
      Access into IOUtil Takes arguments, gets product source and handler Streams source to handler
      static void printUsage()
      CLI usage
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INFILE_ARGUMENT

        public static final java.lang.String INFILE_ARGUMENT
        Argument for input file
        See Also:
        Constant Field Values
      • INFORMAT_ARGUMENT

        public static final java.lang.String INFORMAT_ARGUMENT
        Argument for input format
        See Also:
        Constant Field Values
      • OUTFILE_ARGUMENT

        public static final java.lang.String OUTFILE_ARGUMENT
        Argument for output file
        See Also:
        Constant Field Values
      • OUTFORMAT_ARGUMENT

        public static final java.lang.String OUTFORMAT_ARGUMENT
        Argument for output format
        See Also:
        Constant Field Values
      • DIRECTORY_FORMAT

        public static final java.lang.String DIRECTORY_FORMAT
        Directory format
        See Also:
        Constant Field Values
      • BINARY_FORMAT

        public static final java.lang.String BINARY_FORMAT
        Binary format
        See Also:
        Constant Field Values
    • Constructor Detail

      • IOUtil

        public IOUtil()
    • Method Detail

      • getProductHandler

        public static ProductHandler getProductHandler​(java.lang.String outformat,
                                                       java.io.File outfile)
                                                throws java.io.IOException
        Returns a ProductHandler based on the output format
        Parameters:
        outformat - Output format
        outfile - Output file
        Returns:
        a Product Handler
        Throws:
        java.io.IOException - if IO error occurs
      • getProductSource

        public static ProductSource getProductSource​(java.lang.String informat,
                                                     java.io.File infile)
                                              throws java.lang.IllegalArgumentException,
                                                     java.io.IOException
        Returns a product source based on input format
        Parameters:
        informat - input file format
        infile - input file
        Returns:
        a Productsource
        Throws:
        java.lang.IllegalArgumentException - if informat argument error
        java.io.IOException - if error occurs
      • autoDetectProductSource

        public static ProductSource autoDetectProductSource​(java.io.InputStream in)
                                                     throws java.io.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:
        java.io.IOException - if neither binary or xml product source is in stream.
      • autoDetectDeflate

        public static java.io.BufferedInputStream autoDetectDeflate​(java.io.InputStream in)
                                                             throws java.io.IOException
        Auto detect an optionally deflated stream.
        Parameters:
        in - input stream containing optionally deflated xml or binary product stream.
        Returns:
        ProductSource object.
        Throws:
        java.io.IOException - if neither binary or xml product source is in stream.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.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:
        java.lang.Exception - if error occurs
      • printUsage

        public static void printUsage()
        CLI usage