Class CompressedFileUtils

java.lang.Object
com.illumon.iris.db.tables.utils.CompressedFileUtils

public class CompressedFileUtils
extends Object
Util File that handles .zst file compressions in addition to compression formats supported by CompressedFileUtil
  • Constructor Details

  • Method Details

    • openPossiblyCompressedFile

      public static InputStream openPossiblyCompressedFile​(String sFileName) throws IOException
      Takes in the full path of a file and returns an instance of InputStream after checking and decompressing the file if it is one of ".gz", ".tgz", ".tar.gz", ".zip", ".bz2", ".7z", ".zst" compression formats, otherwise returns an instance of InputStream as is.
      Parameters:
      sFileName - full path including the filename of the possible compression file
      Returns:
      The InputStream of the given file after decompressing if necessary.
      Throws:
      IOException - if an IOException occurs when handling the given file
    • isZeeStandardCompressedFile

      public static boolean isZeeStandardCompressedFile​(String sFileName) throws IOException
      Method reads the first 4 bytes of the passed in file and returns true if they match Zstandard compression formats magic number
      Parameters:
      sFileName - full path including the filename of the possible compression file
      Returns:
      true if given path represents a file compressed using the Zstandard compression format
      Throws:
      IOException - if an IOException occurs when verifying the given file
    • openZeeStandardCompressedFile

      public static InputStream openZeeStandardCompressedFile​(String sFileName) throws IOException
      The given Zstandard compressed file, is opened using ZstdCompressorInputStream and returned as an InputStream
      Parameters:
      sFileName - full path including the filename of the Zstandard compressed file
      Returns:
      InputStream after decompressing using ZstdCompressorInputStream on the given file
      Throws:
      IOException - if an IOException occurs when opening the given file