Package org.apache.pinot.common.utils
Class TarGzCompressionUtils
- java.lang.Object
-
- org.apache.pinot.common.utils.TarGzCompressionUtils
-
public class TarGzCompressionUtils extends Object
Utility class to compress/de-compress tar.gz files.
-
-
Field Summary
Fields Modifier and Type Field Description static longNO_DISK_WRITE_RATE_LIMITstatic longSYNC_DISK_WRITE_WITH_UPSTREAM_RATEstatic StringTAR_GZ_FILE_EXTENSION
-
Method Summary
Modifier and Type Method Description static longcopyWithRateLimiter(InputStream inputStream, FileOutputStream outputStream, long maxStreamRateInByte)static voidcreateTarGzFile(File[] inputFiles, File outputFile)Creates a tar.gz file from a list of input file/directories to the output file.static voidcreateTarGzFile(File inputFile, File outputFile)Creates a tar.gz file from the input file/directory to the output file.static List<File>untar(File inputFile, File outputDir)Un-tars a tar.gz file into a directory, returns all the untarred files/directories.static List<File>untar(InputStream inputStream, File outputDir)Un-tars an inputstream of a tar.gz file into a directory, returns all the untarred files/directories.static voiduntarOneFile(File inputFile, String fileName, File outputFile)Un-tars one single file with the given file name from a tar.gz file.static List<File>untarWithRateLimiter(InputStream inputStream, File outputDir, long maxStreamRateInByte)Un-tars an inputstream of a tar.gz file into a directory, returns all the untarred files/directories.
-
-
-
Field Detail
-
NO_DISK_WRITE_RATE_LIMIT
public static final long NO_DISK_WRITE_RATE_LIMIT
- See Also:
- Constant Field Values
-
SYNC_DISK_WRITE_WITH_UPSTREAM_RATE
public static final long SYNC_DISK_WRITE_WITH_UPSTREAM_RATE
- See Also:
- Constant Field Values
-
TAR_GZ_FILE_EXTENSION
public static final String TAR_GZ_FILE_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
createTarGzFile
public static void createTarGzFile(File inputFile, File outputFile) throws IOException
Creates a tar.gz file from the input file/directory to the output file. The output file must have ".tar.gz" as the file extension.- Throws:
IOException
-
createTarGzFile
public static void createTarGzFile(File[] inputFiles, File outputFile) throws IOException
Creates a tar.gz file from a list of input file/directories to the output file. The output file must have ".tar.gz" as the file extension.- Throws:
IOException
-
untar
public static List<File> untar(File inputFile, File outputDir) throws IOException
Un-tars a tar.gz file into a directory, returns all the untarred files/directories.For security reason, the untarred files must reside in the output directory.
- Throws:
IOException
-
untar
public static List<File> untar(InputStream inputStream, File outputDir) throws IOException
Un-tars an inputstream of a tar.gz file into a directory, returns all the untarred files/directories.For security reason, the untarred files must reside in the output directory.
- Throws:
IOException
-
untarWithRateLimiter
public static List<File> untarWithRateLimiter(InputStream inputStream, File outputDir, long maxStreamRateInByte) throws IOException
Un-tars an inputstream of a tar.gz file into a directory, returns all the untarred files/directories. RateLimit limits the untar rateFor security reason, the untarred files must reside in the output directory.
- Throws:
IOException
-
untarOneFile
public static void untarOneFile(File inputFile, String fileName, File outputFile) throws IOException
Un-tars one single file with the given file name from a tar.gz file.- Throws:
IOException
-
copyWithRateLimiter
public static long copyWithRateLimiter(InputStream inputStream, FileOutputStream outputStream, long maxStreamRateInByte) throws IOException
- Throws:
IOException
-
-