本文整理了Java中org.ops4j.io.ZipExploder
类的一些代码示例,展示了ZipExploder
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipExploder
类的具体详情如下:
包路径:org.ops4j.io.ZipExploder
类名称:ZipExploder
[英]class for exploding jar/zip files onto the file system
[中]类,用于将jar/zip文件分解到文件系统中
代码示例来源:origin: org.ops4j.base/ops4j-base-io
/**
* Explode source ZIP files into a target directory
*
* @param zipFiles
* list of source files
* @param destDir
* target directory name (should already exist)
* @exception IOException
* error creating a target file
*/
public void processZips(File[] zipFiles, File destDir) throws IOException {
for (int i = 0; i < zipFiles.length; i++) {
processFile(zipFiles[i], destDir);
}
}
代码示例来源:origin: org.ops4j.base/ops4j-base-io
/**
* copy a single entry from the archive
*
* @param destDir
* @param zf
* @param ze
* @throws IOException
* @deprecated use {@link #copyFileEntry(File, ZipFile, ZipEntry)} for a
* type save variant
*/
@Deprecated
public void copyFileEntry(String destDir, ZipFile zf, ZipEntry ze) throws IOException {
//Delegation to preferred method
copyFileEntry(new File(destDir), zf, ze);
}
代码示例来源:origin: org.ops4j.pax.exam/pax-exam
/**
* Download and unpacks the archive.
*
* @throws IOException on I/O errors
*/
public void downloadAndInstall() throws IOException {
installDir.mkdirs();
File tempFile = File.createTempFile("pax-exam", ".zip");
FileOutputStream os = null;
LOG.info("downloading {} to {}", zipUrl, tempFile);
try {
os = new FileOutputStream(tempFile);
StreamUtils.copyStream(zipUrl.openStream(), os, true);
LOG.info("unzipping into {}", installDir);
ZipExploder exploder = new ZipExploder();
exploder.processFile(tempFile, installDir);
}
finally {
tempFile.delete();
}
}
}
代码示例来源:origin: org.ops4j.base/ops4j-base-io
printHelp();
System.exit(0);
verbose = true;
} else {
reportError("Invalid switch - " + arg);
} else if (destDirActive) {
if (destDir != null) {
reportError("duplicate argument - " + "-destDir");
reportError("Too many parameters - " + arg);
reportError("Missing parameters");
ZipExploder ze = new ZipExploder(verbose);
ze.process(FileUtils.pathNamesToFiles(zipNames.toArray(new String[zipNames.size()])), FileUtils.pathNamesToFiles(jarNames.toArray(new String[jarNames.size()])), new File(destDir));
} catch (IOException ioe) {
System.err.println("Exception - " + ioe.getMessage());
代码示例来源:origin: org.ops4j.base/ops4j-base-io
try {
f = new ZipFile(zipFile);
Map<String, ZipEntry> fEntries = getEntries(f);
String[] names = fEntries.keySet().toArray(new String[] {});
if (sortNames) {
String name = names[i];
ZipEntry e = fEntries.get(name);
copyFileEntry(destDir, f, e);
代码示例来源:origin: org.ops4j.base/ops4j-base-io
/**
* Explode source JAR and/or ZIP files into a target directory
*
* @param zipNames
* names of source files
* @param jarNames
* names of source files
* @param destDir
* target directory name (should already exist)
* @exception IOException
* error creating a target file
* @deprecated use {@link #process(File[], File[], File)} for a type save
* variant of this method
*/
@Deprecated
public void process(String[] zipNames, String[] jarNames, String destDir) throws IOException {
//Delegation to preferred method
process(FileUtils.pathNamesToFiles(zipNames), FileUtils.pathNamesToFiles(jarNames), new File(destDir));
}
代码示例来源:origin: ops4j/org.ops4j.pax.exam2
/**
* Download and unpacks the archive.
*
* @throws IOException on I/O errors
*/
public void downloadAndInstall() throws IOException {
installDir.mkdirs();
File tempFile = File.createTempFile("pax-exam", ".zip");
FileOutputStream os = null;
LOG.info("downloading {} to {}", zipUrl, tempFile);
try {
os = new FileOutputStream(tempFile);
StreamUtils.copyStream(zipUrl.openStream(), os, true);
LOG.info("unzipping into {}", installDir);
ZipExploder exploder = new ZipExploder();
exploder.processFile(tempFile, installDir);
}
finally {
tempFile.delete();
}
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.exam2
/**
* Download and unpacks the archive.
*
* @throws IOException on I/O errors
*/
public void downloadAndInstall() throws IOException {
installDir.mkdirs();
File tempFile = File.createTempFile("pax-exam", ".zip");
FileOutputStream os = null;
LOG.info("downloading {} to {}", zipUrl, tempFile);
try {
os = new FileOutputStream(tempFile);
StreamUtils.copyStream(zipUrl.openStream(), os, true);
LOG.info("unzipping into {}", installDir);
ZipExploder exploder = new ZipExploder();
exploder.processFile(tempFile, installDir);
}
finally {
tempFile.delete();
}
}
}
代码示例来源:origin: org.ops4j.base/ops4j-base-io
/**
* Explode source JAR files into a target directory
*
* @param jarFiles
* list of source files
* @param destDir
* target directory name (should already exist)
* @exception IOException
* error creating a target file
*/
public void processJars(File[] jarFiles, File destDir) throws IOException {
for (int i = 0; i < jarFiles.length; i++) {
processFile(jarFiles[i], destDir);
}
}
代码示例来源:origin: org.ops4j.base/ops4j-base-io
/**
* copy a single entry from the archive
*
* @param destDir
* @param zf
* @param ze
* @throws IOException
*/
public void copyFileEntry(File destDir, ZipFile zf, ZipEntry ze) throws IOException {
BufferedInputStream dis = new BufferedInputStream(zf.getInputStream(ze));
try {
copyFileEntry(destDir, ze.isDirectory(), ze.getName(), dis);
} finally {
try {
dis.close();
} catch (IOException ioe) {
}
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.exam2
private File getWebResourceDir() throws IOException {
File webResourceDir = new File(tempDir, "webapp");
LOG.debug("building webapp in {}", webResourceDir);
ZipExploder exploder = new ZipExploder();
webResourceDir.mkdir();
exploder.processFile(file, webResourceDir);
代码示例来源:origin: org.ops4j.base/ops4j-base-io
/**
* Explode source ZIP or JAR file into a target directory
*
* @param zipName
* names of source file
* @param destDir
* target directory name (should already exist)
* @exception IOException
* error creating a target file
* @deprecated use {@link #processFile(File, File)} for a type save variant
*/
@Deprecated
public void processFile(String zipName, String destDir) throws IOException {
//Delegation to preferred method
processFile(new File(zipName), new File(destDir));
}
内容来源于网络,如有侵权,请联系作者删除!