ZipUtil2
public
class
ZipUtil2
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.ZipUtil2
|
A helper class for zip extraction that takes POSIX file permissions into account
Summary
Public methods |
static
void
|
closeZip(ZipFile zipFile)
Close an open ZipFile , ignoring any exceptions.
|
static
File
|
extractFileFromZip(ZipFile zipFile, String filePath)
Utility method to extract one specific file from zip file into a tmp file
|
static
boolean
|
extractFileFromZip(ZipFile zipFile, String filePath, File destFile)
Utility method to extract one specific file from zip file
|
static
void
|
extractZip(ZipFile zipFile, File destDir)
Utility method to extract entire contents of zip file into given directory
|
static
void
|
extractZip(File toUnzip, File destDir)
Utility method to extract a zip file into a given directory.
|
static
File
|
extractZipToTemp(File zipFile, String nameHint)
Extract a zip file to a temp directory prepended with a string
|
Public constructors
ZipUtil2
public ZipUtil2 ()
Public methods
closeZip
public static void closeZip (ZipFile zipFile)
Close an open ZipFile
, ignoring any exceptions.
Parameters |
zipFile |
ZipFile : the file to close |
public static File extractFileFromZip (ZipFile zipFile,
String filePath)
Utility method to extract one specific file from zip file into a tmp file
Parameters |
zipFile |
ZipFile : the ZipFile to extract |
filePath |
String : the filePath of to extract |
Throws |
|
if failed to extract file |
public static boolean extractFileFromZip (ZipFile zipFile,
String filePath,
File destFile)
Utility method to extract one specific file from zip file
Parameters |
zipFile |
ZipFile : the ZipFile to extract |
filePath |
String : the file path in the zip |
destFile |
File : the ERROR(/File) to extract to |
Returns |
boolean |
whether the file is found and extracted |
Throws |
|
if failed to extract file |
public static void extractZip (ZipFile zipFile,
File destDir)
Utility method to extract entire contents of zip file into given directory
Parameters |
zipFile |
ZipFile : the ZipFile to extract |
destDir |
File : the local dir to extract file to |
Throws |
|
if failed to extract file |
public static void extractZip (File toUnzip,
File destDir)
Utility method to extract a zip file into a given directory. The zip file being presented as
a ERROR(/File)
.
Parameters |
toUnzip |
File : a ERROR(/File) pointing to a zip file. |
destDir |
File : the local dir to extract file to |
Throws |
|
if failed to extract file |
public static File extractZipToTemp (File zipFile,
String nameHint)
Extract a zip file to a temp directory prepended with a string
Parameters |
zipFile |
File : the zip file to extract |
nameHint |
String : a prefix for the temp directory |