Class BinaryXmlIOComparison


  • public class BinaryXmlIOComparison
    extends java.lang.Object
    Compare io times of XML and Binary product formats. All conversion is done in memory to try to balance the tests. All writes use a BinaryProductSource to keep the playing field level.
    • Constructor Detail

      • BinaryXmlIOComparison

        public BinaryXmlIOComparison()
    • Method Detail

      • timeSerializeProduct

        public static long timeSerializeProduct​(ProductSource source,
                                                ProductHandler handler)
                                         throws java.lang.Exception
        Serializes product by streaming it to a handler
        Parameters:
        source - a productSource
        handler - a productHandler
        Returns:
        Time it took to stream source to handler
        Throws:
        java.lang.Exception - if error occurs
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Testing for class
        Parameters:
        args - CLI args
        Throws:
        java.lang.Exception - if error occurs
      • testProductIO

        public static void testProductIO​(Product product,
                                         int numRuns)
                                  throws java.lang.Exception
        Tests product IO
        Parameters:
        product - Produc
        numRuns - int
        Throws:
        java.lang.Exception - if error occurs
      • testXmlReads

        public static void testXmlReads​(Product product,
                                        int numReads)
                                 throws java.lang.Exception
        Tests XML reading
        Parameters:
        product - a product
        numReads - int
        Throws:
        java.lang.Exception - if error occurs
      • testBinaryReads

        public static void testBinaryReads​(Product product,
                                           int numReads)
                                    throws java.lang.Exception
        Tests binary reading
        Parameters:
        product - a product
        numReads - int
        Throws:
        java.lang.Exception - if error occurs
      • testBinaryWrites

        public static void testBinaryWrites​(Product product,
                                            int numWrites)
                                     throws java.lang.Exception
        Tests binary writes
        Parameters:
        product - a product
        numWrites - int
        Throws:
        java.lang.Exception - if error occurs
      • testXmlWrites

        public static void testXmlWrites​(Product product,
                                         int numWrites)
                                  throws java.lang.Exception
        tests xml writes
        Parameters:
        product - a product
        numWrites - int
        Throws:
        java.lang.Exception - if error occurs