Package io.deephaven.io
Class CompressedFileUtil
- java.lang.Object
-
- io.deephaven.io.CompressedFileUtil
-
public class CompressedFileUtil extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCompressedFileUtil.FileInputStreamFactorystatic classCompressedFileUtil.FilePipe
-
Field Summary
Fields Modifier and Type Field Description static intBZIP2_MAGICstatic java.lang.String[]COMPRESSION_EXTENSIONSstatic longUINT_TO_LONG
-
Constructor Summary
Constructors Constructor Description CompressedFileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringaddCompressionExtensionIfNeeded(java.lang.String sFileName)If the given file doesn't exist, looks to see if a compressed version of the file exists.static intbunzip2(java.io.File file)Unzip the filestatic voidbzip2(java.lang.String archiveName, java.lang.String baseDir, java.lang.String[] inputFiles)Files need to be in the same directory, otherwise Tar complains about windows pathsstatic InputStreamFactorycreateInputStreamFactoryForPossiblyCompressedStream(InputStreamFactory inputStreamFactory)static InputStreamFactorycreateInputStreamFactoryForPossiblyTarredStream(InputStreamFactory inputStreamFactory)static intgetMagic2(java.io.InputStream testStream)static intgetMagic4(java.io.InputStream testStream, int nMagic2)static longgetMagic6(java.io.InputStream testStream, int nMagic4)static java.io.InputStreamopenPossiblyCompressedFile(InputStreamFactory inputStreamFactory)Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not.static java.io.InputStreamopenPossiblyCompressedFile(java.lang.String sFileName)static java.io.InputStreamopenPossiblyCompressedFile(java.lang.String sFileName, int bufferedSize)static java.io.InputStreamopenPossiblyCompressedFile(java.lang.String sFileName, int bufferedSize, java.lang.Boolean useMicrosPcapEmulation)static java.io.InputStreamopenPossiblyCompressedFile(java.lang.String sFileName, java.lang.Boolean useMicrosPcapEmulation)Open the file, automatically determining if it has been zipped, GZipped, BZip2'd or not.static java.io.InputStreamopenPossiblyCompressedFiles(java.lang.String[] fileNames)static voidunbzip2(java.io.File archive)static voidzipFile(java.io.File inputFile, java.io.File zipFilePath)
-
-
-
Field Detail
-
UINT_TO_LONG
public static final long UINT_TO_LONG
- See Also:
- Constant Field Values
-
BZIP2_MAGIC
public static final int BZIP2_MAGIC
- See Also:
- Constant Field Values
-
COMPRESSION_EXTENSIONS
public static final java.lang.String[] COMPRESSION_EXTENSIONS
-
-
Method Detail
-
bunzip2
public static int bunzip2(java.io.File file) throws java.io.IOExceptionUnzip 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.IOExceptionFiles 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:
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.IOExceptionOpen 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:
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
-
-