Package io.deephaven.io
Class CompressedFileUtil
java.lang.Object
io.deephaven.io.CompressedFileUtil
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
addCompressionExtensionIfNeeded
(String sFileName) If the given file doesn't exist, looks to see if a compressed version of the file exists.static int
Unzip the filestatic void
Files need to be in the same directory, otherwise Tar complains about windows pathsstatic InputStreamFactory
createInputStreamFactoryForPossiblyCompressedStream
(InputStreamFactory inputStreamFactory) static InputStreamFactory
createInputStreamFactoryForPossiblyTarredStream
(InputStreamFactory inputStreamFactory) static int
getMagic2
(InputStream testStream) static int
getMagic4
(InputStream testStream, int nMagic2) static long
getMagic6
(InputStream testStream, int nMagic4) static InputStream
openPossiblyCompressedFile
(InputStreamFactory inputStreamFactory) Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not.static InputStream
openPossiblyCompressedFile
(String sFileName) static InputStream
openPossiblyCompressedFile
(String sFileName, int bufferedSize) static InputStream
openPossiblyCompressedFile
(String sFileName, int bufferedSize, Boolean useMicrosPcapEmulation) static InputStream
openPossiblyCompressedFile
(String sFileName, Boolean useMicrosPcapEmulation) Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not.static InputStream
openPossiblyCompressedFiles
(String[] fileNames) static void
static void
-
Field Details
-
UINT_TO_LONG
public static final long UINT_TO_LONG- See Also:
-
BZIP2_MAGIC
public static final int BZIP2_MAGIC- See Also:
-
COMPRESSION_EXTENSIONS
-
-
Constructor Details
-
CompressedFileUtil
public CompressedFileUtil()
-
-
Method Details
-
bunzip2
Unzip the file- Parameters:
file
- The file to bunzip2- Throws:
IOException
-
bzip2
public static void bzip2(String archiveName, String baseDir, String[] inputFiles) throws 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 locatedinputFiles
-- Throws:
IOException
-
unbzip2
- Throws:
IOException
-
zipFile
- Throws:
IOException
-
openPossiblyCompressedFiles
- Throws:
IOException
-
addCompressionExtensionIfNeeded
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 InputStream openPossiblyCompressedFile(String sFileName, Boolean useMicrosPcapEmulation) throws IOException Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not. The returned input stream will be buffered. See alsoaddCompressionExtensionIfNeeded(java.lang.String)
.- Throws:
IOException
-
openPossiblyCompressedFile
- Throws:
IOException
-
openPossiblyCompressedFile
public static InputStream openPossiblyCompressedFile(String sFileName, int bufferedSize, Boolean useMicrosPcapEmulation) throws IOException - Throws:
IOException
-
openPossiblyCompressedFile
public static InputStream openPossiblyCompressedFile(String sFileName, int bufferedSize) throws IOException - Throws:
IOException
-
openPossiblyCompressedFile
public static InputStream openPossiblyCompressedFile(InputStreamFactory inputStreamFactory) throws IOException Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not.- Throws:
IOException
-
createInputStreamFactoryForPossiblyCompressedStream
public static InputStreamFactory createInputStreamFactoryForPossiblyCompressedStream(InputStreamFactory inputStreamFactory) throws IOException - Throws:
IOException
-
getMagic6
- Throws:
IOException
-
getMagic4
- Throws:
IOException
-
getMagic2
- Throws:
IOException
-
createInputStreamFactoryForPossiblyTarredStream
public static InputStreamFactory createInputStreamFactoryForPossiblyTarredStream(InputStreamFactory inputStreamFactory) throws IOException - Throws:
IOException
-