Class CompressedFileUtil


  • public class CompressedFileUtil
    extends java.lang.Object
    • Field Detail

      • COMPRESSION_EXTENSIONS

        public static final java.lang.String[] COMPRESSION_EXTENSIONS
    • Constructor Detail

      • CompressedFileUtil

        public CompressedFileUtil()
    • Method Detail

      • bunzip2

        public static int bunzip2​(java.io.File file)
                           throws java.io.IOException
        Unzip the file
        Parameters:
        file - The file to bunzip2
        Throws:
        java.io.IOException
      • bzip2

        public static void bzip2​(java.lang.String archiveName,
                                 java.lang.String baseDir,
                                 java.lang.String[] inputFiles)
                          throws java.io.IOException
        Files need to be in the same directory, otherwise Tar complains about windows paths
        Parameters:
        archiveName -
        baseDir - the directory where the input files are located
        inputFiles -
        Throws:
        java.io.IOException
      • unbzip2

        public static void unbzip2​(java.io.File archive)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • zipFile

        public static void zipFile​(java.io.File inputFile,
                                   java.io.File zipFilePath)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • openPossiblyCompressedFiles

        public static java.io.InputStream openPossiblyCompressedFiles​(java.lang.String[] fileNames)
                                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • addCompressionExtensionIfNeeded

        public static java.lang.String addCompressionExtensionIfNeeded​(java.lang.String sFileName)
        If the given file doesn't exist, looks to see if a compressed version of the file exists. If no file is found, returns the original file name.
      • openPossiblyCompressedFile

        public static java.io.InputStream openPossiblyCompressedFile​(java.lang.String sFileName,
                                                                     java.lang.Boolean useMicrosPcapEmulation)
                                                              throws java.io.IOException
        Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not. The returned input stream will be buffered. See also addCompressionExtensionIfNeeded(java.lang.String).
        Throws:
        java.io.IOException
      • openPossiblyCompressedFile

        public static java.io.InputStream openPossiblyCompressedFile​(java.lang.String sFileName)
                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • openPossiblyCompressedFile

        public static java.io.InputStream openPossiblyCompressedFile​(java.lang.String sFileName,
                                                                     int bufferedSize,
                                                                     java.lang.Boolean useMicrosPcapEmulation)
                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • openPossiblyCompressedFile

        public static java.io.InputStream openPossiblyCompressedFile​(java.lang.String sFileName,
                                                                     int bufferedSize)
                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • openPossiblyCompressedFile

        public static java.io.InputStream openPossiblyCompressedFile​(InputStreamFactory inputStreamFactory)
                                                              throws java.io.IOException
        Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not.
        Throws:
        java.io.IOException
      • createInputStreamFactoryForPossiblyCompressedStream

        public static InputStreamFactory createInputStreamFactoryForPossiblyCompressedStream​(InputStreamFactory inputStreamFactory)
                                                                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • getMagic6

        public static long getMagic6​(java.io.InputStream testStream,
                                     int nMagic4)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getMagic4

        public static int getMagic4​(java.io.InputStream testStream,
                                    int nMagic2)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • getMagic2

        public static int getMagic2​(java.io.InputStream testStream)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • createInputStreamFactoryForPossiblyTarredStream

        public static InputStreamFactory createInputStreamFactoryForPossiblyTarredStream​(InputStreamFactory inputStreamFactory)
                                                                                  throws java.io.IOException
        Throws:
        java.io.IOException