Class BinaryXmlIOComparison

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

public class BinaryXmlIOComparison extends 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 Details

    • BinaryXmlIOComparison

      public BinaryXmlIOComparison()
  • Method Details

    • timeSerializeProduct

      public static long timeSerializeProduct(ProductSource source, ProductHandler handler) throws 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:
      Exception - if error occurs
    • main

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

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

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

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

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

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