Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
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 |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-08 UTC."],[],[]]