Package com.illumon.iris.db.tables.utils
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 Summary
Constructors Constructor Description CompressedFileUtils()
-
Method Summary
Modifier and Type Method Description static boolean
isZeeStandardCompressedFile(String sFileName)
Method reads the first 4 bytes of the passed in file and returns true if they match Zstandard compression formats magic numberstatic InputStream
openPossiblyCompressedFile(String sFileName)
Takes in the full path of a file and returns an instance ofInputStream
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 ofInputStream
as is.static InputStream
openZeeStandardCompressedFile(String sFileName)
The given Zstandard compressed file, is opened usingZstdCompressorInputStream
and returned as anInputStream
-
Constructor Details
-
CompressedFileUtils
public CompressedFileUtils()
-
-
Method Details
-
openPossiblyCompressedFile
Takes in the full path of a file and returns an instance ofInputStream
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 ofInputStream
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
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
The given Zstandard compressed file, is opened usingZstdCompressorInputStream
and returned as anInputStream
- 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
-