|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.io.TarUtils
public class TarUtils
A helper class for Tar-file related tasks.
| Nested Class Summary | |
|---|---|
static class |
TarUtils.Compression
The type of compression to use. |
| Constructor Summary | |
|---|---|
TarUtils()
|
|
| Method Summary | |
|---|---|
static String |
compress(File output,
File[] files)
Creates a tar file from the specified files. |
static String |
compress(File output,
File[] files,
int bufferSize)
Creates a tar file from the specified files. |
static String |
compress(File output,
File[] files,
String stripRegExp,
int bufferSize)
Creates a tar file from the specified files. |
static List<File> |
decompress(File input,
File outputDir)
Decompresses the files in a tar file. |
static List<File> |
decompress(File input,
File outputDir,
boolean createDirs)
Decompresses the files in a tar file. |
static List<File> |
decompress(File input,
File outputDir,
boolean createDirs,
BaseRegExp match,
boolean invertMatch)
Decompresses the files in a tar file. |
static List<File> |
decompress(File input,
File outputDir,
boolean createDirs,
BaseRegExp match,
boolean invertMatch,
int bufferSize)
Decompresses the files in a tar file. |
static List<File> |
decompress(File input,
File outputDir,
boolean createDirs,
BaseRegExp match,
boolean invertMatch,
int bufferSize,
StringBuilder errors)
Decompresses the files in a tar file. |
static boolean |
decompress(File input,
String archiveFile,
File output)
Decompresses the specified file from a tar file. |
static boolean |
decompress(File input,
String archiveFile,
File output,
boolean createDirs)
Decompresses the specified file from a tar file. |
static boolean |
decompress(File input,
String archiveFile,
File output,
boolean createDirs,
int bufferSize,
StringBuilder errors)
Decompresses the specified file from a tar file. |
static TarUtils.Compression |
determineCompression(File archive)
Determines the compression based on the the file extension. |
static TarUtils.Compression |
determineCompression(String archive)
Determines the compression based on the the file extension. |
static List<File> |
listFiles(File input)
Lists the files stored in the tar file. |
static List<File> |
listFiles(File input,
boolean listDirs)
Lists the files stored in the tar file. |
protected static org.apache.commons.compress.archivers.tar.TarArchiveInputStream |
openArchiveForReading(File input)
Returns an input stream for the specified tar archive. |
protected static org.apache.commons.compress.archivers.tar.TarArchiveOutputStream |
openArchiveForWriting(File input)
Returns an output stream for the specified tar archive. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TarUtils()
| Method Detail |
|---|
public static TarUtils.Compression determineCompression(File archive)
archive - the archive to determine the compression for
public static TarUtils.Compression determineCompression(String archive)
archive - the archive to determine the compression for
protected static org.apache.commons.compress.archivers.tar.TarArchiveInputStream openArchiveForReading(File input)
throws Exception
input - the tar archive to create the input stream for
Exception - if file not found or similar problems
protected static org.apache.commons.compress.archivers.tar.TarArchiveOutputStream openArchiveForWriting(File input)
throws Exception
input - the tar archive to create the output stream for
Exception - if file not found or similar problemsTarArchiveOutputStream.LONGFILE_GNU
public static String compress(File output,
File[] files)
output - the output file to generatefiles - the files to store in the tar file
compress(File, File[], int)
public static String compress(File output,
File[] files,
int bufferSize)
output - the output file to generatefiles - the files to store in the tar filebufferSize - the buffer size to use
compress(File, File[], String, int)
public static String compress(File output,
File[] files,
String stripRegExp,
int bufferSize)
output - the output file to generatefiles - the files to store in the tar filestripRegExp - the regular expression used to strip the file namesbufferSize - the buffer size to use
public static List<File> decompress(File input,
File outputDir)
input - the tar file to decompressoutputDir - the directory where to store the extracted files
decompress(File, File, boolean)
public static List<File> decompress(File input,
File outputDir,
boolean createDirs)
input - the tar file to decompressoutputDir - the directory where to store the extracted filescreateDirs - whether to re-create the directory structure from the
tar file
#decompress(File, File, boolean, String, boolean)
public static List<File> decompress(File input,
File outputDir,
boolean createDirs,
BaseRegExp match,
boolean invertMatch)
input - the tar file to decompressoutputDir - the directory where to store the extracted filescreateDirs - whether to re-create the directory structure from the
tar filematch - the regular expression that the files are matched againstinvertMatch - whether to invert the matching sense
#decompress(File, File, boolean, String, boolean, int)
public static List<File> decompress(File input,
File outputDir,
boolean createDirs,
BaseRegExp match,
boolean invertMatch,
int bufferSize)
input - the tar file to decompressoutputDir - the directory where to store the extracted filescreateDirs - whether to re-create the directory structure from the
tar filematch - the regular expression that the files are matched againstinvertMatch - whether to invert the matching sensebufferSize - the buffer size to use
public static List<File> decompress(File input,
File outputDir,
boolean createDirs,
BaseRegExp match,
boolean invertMatch,
int bufferSize,
StringBuilder errors)
input - the tar file to decompressoutputDir - the directory where to store the extracted filescreateDirs - whether to re-create the directory structure from the
tar filematch - the regular expression that the files are matched againstinvertMatch - whether to invert the matching sensebufferSize - the buffer size to useerrors - for storing potential errors
public static boolean decompress(File input,
String archiveFile,
File output)
input - the tar file to decompressarchiveFile - the file from the archive to extractoutput - the name of the output file
public static boolean decompress(File input,
String archiveFile,
File output,
boolean createDirs)
input - the tar file to decompressarchiveFile - the file from the archive to extractoutput - the name of the output filecreateDirs - whether to create the directory structure represented
by output file
public static boolean decompress(File input,
String archiveFile,
File output,
boolean createDirs,
int bufferSize,
StringBuilder errors)
input - the tar file to decompressarchiveFile - the file from the archive to extractoutput - the name of the output filecreateDirs - whether to create the directory structure represented
by output filebufferSize - the buffer size to useerrors - for storing potential errors
public static List<File> listFiles(File input)
input - the tar file to obtain the file list from
public static List<File> listFiles(File input,
boolean listDirs)
input - the tar file to obtain the file list fromlistDirs - whether to include directories in the list
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||