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

voiddecompress(String fileName, String destinationFolder)
decompress
BufferedOutputStream dest = null;
BufferedInputStream is = null;
try {
    ZipEntry entry;
    ZipFile zipfile = new ZipFile(fileName);
    Enumeration<? extends ZipEntry> e = zipfile.entries();
    while (e.hasMoreElements()) {
        entry = e.nextElement();
...
voiddecompress(String filepath, File outpathdir, String includes)
decompress
decompress(filepath, outpathdir.getAbsolutePath(), includes);
voiddecompress(String zipFile, String targetPath)
decompress
int BUFFER = 2048;
ZipFile zipfile = null;
File root = null;
try {
    BufferedOutputStream dest = null;
    BufferedInputStream is = null;
    ZipEntry entry;
    zipfile = new ZipFile(zipFile);
...
File[]decompresses(File file, File destinationDirectory)
Descompress a file zip.
if (!destinationDirectory.exists()) {
    destinationDirectory.mkdir();
if (!destinationDirectory.isDirectory()) {
    throw new IllegalArgumentException("Second param not is a Directory");
ZipFile arquivoZip = new ZipFile(file);
File[] retorno = new File[arquivoZip.size()];
...
voiddecompressFile(File destFile, ZipInputStream zis)
decompress File
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(destFile));
int count;
byte data[] = new byte[BUFFER];
while ((count = zis.read(data, 0, BUFFER)) != -1) {
    bos.write(data, 0, count);
bos.close();
voiddecompressFile(final File toDecompress, final File destinationFile)
Decompreses one gzipped file into another file.
if (destinationFile.exists()) {
    throw new IOException("Refusing to overwrite an existing file.");
InputStream istream = null;
OutputStream ostream = null;
try {
    ostream = new BufferedOutputStream(new FileOutputStream(destinationFile), BUFF_SIZE);
    istream = getCompressedFileAsStream(toDecompress);
...
voiddecompressFile(String inName)
decompress File
try {
    File f = new File(inName);
    String outName = inName.replace(".gz", "");
    File fout = new File(outName);
    if (fout.exists()) {
        System.out.println("Unzip File Already Exist:" + outName);
        System.out.println("Rename:" + outName + "(1)");
        fout = new File(outName + "(1)");
...
voiddecompressGzip(File src, File trgt)
decompress Gzip
InputStream in = new GZIPInputStream(new BufferedInputStream(new FileInputStream(src)));
try {
    OutputStream out = new BufferedOutputStream(new FileOutputStream(trgt));
    try {
        copyStream(in, out);
    } finally {
        out.close();
} finally {
    in.close();
byte[]uncompress(ByteArrayInputStream bais)
uncompress
GZIPInputStream gzipInputStream = new GZIPInputStream(bais);
byte[] buffer = new byte[1024];
int length;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((length = gzipInputStream.read(buffer)) != -1) {
    baos.write(buffer, 0, length);
gzipInputStream.close();
...
voiduncompress(File zipFile, File folder)
uncompress
try (FileInputStream inputStream = new FileInputStream(zipFile)) {
    ZipInputStream zip = new ZipInputStream(inputStream);
    ZipEntry entry;
    byte[] buffer = new byte[1024];
    while ((entry = zip.getNextEntry()) != null) {
        File file = new File(folder, entry.getName());
        File entryfolder = file.getParentFile();
        if (!entryfolder.exists()) {
...