TarUtil

public class TarUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.TarUtil


Utility to manipulate a tar file. It wraps the commons-compress in order to provide tar support.

Summary

Public constructors

TarUtil()

Public methods

static void extractAndLog(ITestLogger listener, File targzFile, String baseName)

Helper to extract and log to the reporters a tar gz file and its content

static File unGzip(File inputFile, File outputDir)

UnGZip a file: a tar.gz file will become a tar file.

static List<File> unTar(File inputFile, File outputDir)

Untar a tar file into a directory.

Public constructors

TarUtil

TarUtil ()

Public methods

extractAndLog

void extractAndLog (ITestLogger listener, 
                File targzFile, 
                String baseName)

Helper to extract and log to the reporters a tar gz file and its content

Parameters
listener ITestLogger: the ITestLogger where to log the files.
targzFile File: the tar.gz File that needs its content log.
baseName String: the base name under which the files will be found.
Throws
FileNotFoundException
IOException

unGzip

File unGzip (File inputFile, 
                File outputDir)

UnGZip a file: a tar.gz file will become a tar file.

Parameters
inputFile File: The File to ungzip
outputDir File: The directory where to put the ungzipped file.
Returns
File a File pointing to the ungzipped file.
Throws
FileNotFoundException
IOException
FileNotFoundException

unTar

List<File> unTar (File inputFile, 
                File outputDir)

Untar a tar file into a directory. tar.gz file need to up unGzip(File, File) first.

Parameters
inputFile File: The tar file to extract
outputDir File: the directory where to put the extracted files.
Returns
List<File> The list of File untarred.
Throws
FileNotFoundException
IOException
FileNotFoundException