public class UtilTar extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
compress(File... files) |
static byte[] |
compress(Path path) |
static void |
compress(String name,
File... files)
Compress one several files or a directory and put the result in the given output path.
|
static void |
decompress(byte[] in,
File out)
Untar a file
|
static void |
decompress(String in,
File out)
Untar a file
|
static byte[] |
gunzip(byte[] input)
Gunzip some byte array.
|
static byte[] |
gzip(byte[] input)
Gzip some data
|
static byte[] |
gzip(byte[] input,
int startOffset,
int endOffset)
A simple gzip utility function
|
static byte[] |
gzip(String input)
A simple gzip utility function
|
public static void compress(String name, File... files) throws IOException
name
- the target absolute path, i.e. "/tmp/archive.tar"files
- the files to tar, it can be directoriesIOException
- in case of problemspublic static byte[] compress(Path path) throws IOException
IOException
public static byte[] compress(File... files) throws IOException
files
- filesIOException
- exceptionpublic static void decompress(byte[] in, File out) throws IOException
in
- the input archive path, i.e. "/tmp/archive.tarout
- the output destination folderIOException
- in case of problemspublic static void decompress(String in, File out) throws IOException
in
- the input archive path, i.e. "/tmp?archive.tarout
- the output destination folderIOException
- in case of file acces problemspublic static byte[] gzip(String input)
input
- your input stringpublic static byte[] gzip(byte[] input, int startOffset, int endOffset)
input
- your input datastartOffset
- the start offsetendOffset
- the end offsetpublic static byte[] gunzip(byte[] input)
input
- your input bytespublic static byte[] gzip(byte[] input)
input
- the input dataCopyright © 2014–2022. All rights reserved.