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);
}
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);
}
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);
}
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;
}
Aggregations