Class BundleChecker

  • All Implemented Interfaces:
    java.lang.Runnable

    public class BundleChecker
    extends java.lang.Object
    implements java.lang.Runnable
    Decompress files and (optionally) checks their checksums.

    File are read from ZIP archive passed as an array of bytes. Multiple checkers negotiate about task distribution via shared AtomicInteger counter.

    All entries are expected to be valid brotli compressed streams and output CRC64 checksum is expected to match the checksum hex-encoded in the first part of entry name.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.InputStream input  
      private java.util.concurrent.atomic.AtomicInteger nextJob  
      private boolean sanityCheck  
    • Constructor Summary

      Constructors 
      Constructor Description
      BundleChecker​(java.io.InputStream input, java.util.concurrent.atomic.AtomicInteger nextJob, boolean sanityCheck)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private long decompressAndCalculateCrc​(java.util.zip.ZipInputStream input)  
      static void main​(java.lang.String[] args)  
      void run()  
      • Methods inherited from class java.lang.Object

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

      • nextJob

        private final java.util.concurrent.atomic.AtomicInteger nextJob
      • input

        private final java.io.InputStream input
      • sanityCheck

        private final boolean sanityCheck
    • Constructor Detail

      • BundleChecker

        public BundleChecker​(java.io.InputStream input,
                             java.util.concurrent.atomic.AtomicInteger nextJob,
                             boolean sanityCheck)
        Parameters:
        sanityCheck - do not calculate checksum and ignore IOException.
    • Method Detail

      • decompressAndCalculateCrc

        private long decompressAndCalculateCrc​(java.util.zip.ZipInputStream input)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException