Java Utililty Methods Unzip File

List of utility methods to do Unzip File

Description

The list of methods to do Unzip File are organized into topic(s).

Method

StringunCompressGzipFile(String path)
un Compress Gzip File
System.out.println(path);
File file = new File(path);
byte[] buffer = new byte[4096];
GZIPInputStream gzip;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
    gzip = new GZIPInputStream(new FileInputStream(file.toString()));
    int len;
...
longuncompressZipEntry(ZipInputStream zis, ZipEntry zipEntry, String dest)
uncompress Zip Entry
byte[] buf = new byte[1024];
String entryName = zipEntry.getName();
int n;
File rootDir = new File(dest);
FileOutputStream fileoutputstream;
File newFile = new File(rootDir, entryName);
long totalLen = 0;
if (zipEntry.isDirectory()) {
...
voidunzip(File aFile)
Unzips the given file into the destination file.
try {
    FileInputStream fis = new FileInputStream(aFile);
    ZipInputStream zis = new ZipInputStream(fis);
    byte buffer[] = new byte[8192];
    for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) {
        File outputFile = new File(aFile.getParent(), entry.getName());
        if (entry.isDirectory()) {
            outputFile.mkdir();
...
voidunzip(File archive)
Will decompress a ZIP archive to the current folder.
unzip(archive, null);
voidunzip(File archive, File output)
Unzip a ZIP archive into the specified output directory
try {
    if (!output.exists()) {
        output.mkdir();
    ZipInputStream zis = new ZipInputStream(new FileInputStream(archive));
    ZipEntry ze = zis.getNextEntry();
    while (ze != null) {
        String fileName = ze.getName();
...
voidunzip(File archiveFile, File destination)
Unzip a given archive to a given destination.
try (FileInputStream fis = new FileInputStream(archiveFile);
        ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) {
    ZipEntry entry;
    while ((entry = zis.getNextEntry()) != null) {
        int count;
        byte data[] = new byte[BUFFER];
        File file = new File(destination, entry.getName());
        if (entry.getName().endsWith("/")) {
...
voidunzip(File archiveFile, File destination)
unzip
try {
    BufferedOutputStream dest = null;
    FileInputStream fis = new FileInputStream(archiveFile);
    ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
    ZipEntry entry;
    File base = destination;
    while ((entry = zis.getNextEntry()) != null) {
        int count;
...
voidunzip(File archiveFile, File targetDir, boolean skipRoot)
unzip
forceMkdir(targetDir);
ZipFile zipFile = new ZipFile(archiveFile);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
    ZipEntry entry = entries.nextElement();
    File entryTarget;
    if (skipRoot) {
        String name = entry.getName();
...
voidunzip(File dest, String jar)
unzip
dest.mkdirs();
ZipFile zf = new ZipFile(jar);
try {
    Enumeration es = zf.entries();
    while (es.hasMoreElements()) {
        ZipEntry je = (ZipEntry) es.nextElement();
        String n = je.getName();
        File f = new File(dest, n);
...
voidunzip(File destDir, InputStream is)
unzip
final int BUFFER = 2048;
try {
    BufferedOutputStream dest = null;
    ZipInputStream zis = new ZipInputStream(is);
    ZipEntry entry;
    while ((entry = zis.getNextEntry()) != null) {
        File destinationFilePath = new File(destDir, entry.getName());
        destinationFilePath.getParentFile().mkdirs();
...