Search in sources :

Example 6 with ZipEntry

use of org.apache.tools.zip.ZipEntry in project translationstudio8 by heartsome.

the class ZipFileExporter2 method addDbFolder.

public void addDbFolder(String destinationPath) throws IOException {
    ZipEntry newEntry = new ZipEntry(destinationPath);
    outputStream.putNextEntry(newEntry);
}
Also used : ZipEntry(org.apache.tools.zip.ZipEntry)

Example 7 with ZipEntry

use of org.apache.tools.zip.ZipEntry in project translationstudio8 by heartsome.

the class ZipFileExporter2 method write.

/**
	 * Write the passed resource to the current archive.
	 * @param resource
	 *            org.eclipse.core.resources.IFile
	 * @param destinationPath
	 *            java.lang.String
	 * @exception java.io.IOException
	 * @exception org.eclipse.core.runtime.CoreException
	 */
public void write(IFile resource, String destinationPath) throws IOException, CoreException {
    ZipEntry newEntry = new ZipEntry(destinationPath);
    write(newEntry, resource);
}
Also used : ZipEntry(org.apache.tools.zip.ZipEntry)

Example 8 with ZipEntry

use of org.apache.tools.zip.ZipEntry in project translationstudio8 by heartsome.

the class ZipFileExporter2 method addDbFile.

public void addDbFile(File file, String destinationPath) throws IOException {
    ZipEntry newEntry = new ZipEntry(destinationPath);
    writeFile(newEntry, file);
}
Also used : ZipEntry(org.apache.tools.zip.ZipEntry)

Example 9 with ZipEntry

use of org.apache.tools.zip.ZipEntry in project tdi-studio-se by Talend.

the class ZipFileUtils method unZip.

public static String unZip(String unZipFileName, String destFileName) {
    File unzipFile = new File(unZipFileName);
    if (destFileName == null || destFileName.trim().length() == 0) {
        destFileName = unzipFile.getParent();
    }
    File destFile;
    ZipFile zipFile = null;
    try {
        zipFile = new ZipFile(unzipFile, "GBK");
        for (Enumeration entries = zipFile.getEntries(); entries.hasMoreElements(); ) {
            ZipEntry entry = (ZipEntry) entries.nextElement();
            destFile = new File(destFileName, entry.getName());
            unZipFile(destFile, zipFile, entry);
        }
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return e.getMessage();
    } finally {
        try {
            assert zipFile != null;
            zipFile.close();
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    return null;
}
Also used : Enumeration(java.util.Enumeration) ZipFile(org.apache.tools.zip.ZipFile) ZipEntry(org.apache.tools.zip.ZipEntry) ZipFile(org.apache.tools.zip.ZipFile) File(java.io.File) IOException(java.io.IOException)

Aggregations

ZipEntry (org.apache.tools.zip.ZipEntry)9 File (java.io.File)4 ZipFile (org.apache.tools.zip.ZipFile)3 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 Enumeration (java.util.Enumeration)2 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 TreeMap (java.util.TreeMap)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ZipOutputStream (org.apache.tools.zip.ZipOutputStream)1 GradleException (org.gradle.api.GradleException)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 UncheckedIOException (org.gradle.api.UncheckedIOException)1