本文整理了Java中org.zeroturnaround.zip.ZipUtil.unpack()
方法的一些代码示例,展示了ZipUtil.unpack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.unpack()
方法的具体详情如下:
包路径:org.zeroturnaround.zip.ZipUtil
类名称:ZipUtil
方法名:unpack
[英]Unpacks a ZIP file to the given directory.
The output directory must not be a file.
[中]将ZIP文件解压缩到给定目录。
输出目录不能是文件。
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP file to the given directory.
* <p>
* The output directory must not be a file.
*
* @param zip
* input ZIP file.
* @param outputDir
* output directory (created automatically if not found).
*/
public static void unpack(File zip, final File outputDir) {
unpack(zip, outputDir, IdentityNameMapper.INSTANCE);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
*/
public static void unpack(InputStream is, File outputDir) {
unpack(is, outputDir, IdentityNameMapper.INSTANCE, null);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
*/
public static void unpack(InputStream is, File outputDir, NameMapper mapper) {
unpack(is, outputDir, mapper, null);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param charset
* charset used to process the zip stream
*/
public static void unpack(InputStream is, File outputDir, Charset charset) {
unpack(is, outputDir, IdentityNameMapper.INSTANCE, charset);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP file to the given directory using a specific Charset
* for the input file.
*
* <p>
* The output directory must not be a file.
*
* @param zip
* input ZIP file.
* @param outputDir
* output directory (created automatically if not found).
*
* @param charset
* charset used to unpack the zip file
*/
public static void unpack(File zip, final File outputDir, Charset charset) {
unpack(zip, outputDir, IdentityNameMapper.INSTANCE, charset);
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void unpack(File outputDir, String charset, @Nullable final Invoker callback) throws FileNotFoundException {
if (!zipFile.isFile()) {
throw new FileNotFoundException(zipFile.getPath() + " not found");
}
NameMapper mapper = invokerToNameMapper(callback);
if (charset == null || charset.isEmpty()) {
ZipUtil.unpack(zipFile, outputDir, mapper);
} else {
ZipUtil.unpack(zipFile, outputDir, Charset.forName(charset));
}
}
代码示例来源:origin: libgdx/packr
ZipUtil.unpack(jar, jarDir);
} else {
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP file to its own location.
* <p>
* The ZIP file will be first renamed (using a temporary name). After the
* extraction it will be deleted.
*
* @param zip
* input ZIP file as well as the target directory.
*
* @see #unpack(File, File)
*/
public static void explode(File zip) {
try {
// Find a new unique name is the same directory
File tempFile = FileUtils.getTempFileFor(zip);
// Rename the archive
FileUtils.moveFile(zip, tempFile);
// Unpack it
unpack(tempFile, zip);
// Delete the archive
if (!tempFile.delete()) {
throw new IOException("Unable to delete file: " + tempFile);
}
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
}
代码示例来源:origin: libgdx/packr
PackrFileUtils.copyDirectory(jdkFile, tmp);
} else {
ZipUtil.unpack(jdkFile, tmp);
代码示例来源:origin: libgdx/packr
System.out.println(" # Unpacking '" + file.getPath() + "' ...");
ZipUtil.unpack(file, fileNoExt);
代码示例来源:origin: org.zeroturnaround/zt-zip
/**
* Unpacks a ZIP file to the given directory.
* <p>
* The output directory must not be a file.
*
* @param zip
* input ZIP file.
* @param outputDir
* output directory (created automatically if not found).
*/
public static void unpack(File zip, final File outputDir) {
unpack(zip, outputDir, IdentityNameMapper.INSTANCE);
}
代码示例来源:origin: hs-web/hsweb-expands
public void unpack(File to) throws IOException {
ZipUtil.unpack(zipFile, to);
}
代码示例来源:origin: org.zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
*/
public static void unpack(InputStream is, File outputDir) {
unpack(is, outputDir, IdentityNameMapper.INSTANCE, null);
}
代码示例来源:origin: org.hswebframework/hsweb-expands-compress
public void unpack(File to) throws IOException {
ZipUtil.unpack(zipFile, to);
}
代码示例来源:origin: org.zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param charset
* charset used to process the zip stream
*/
public static void unpack(InputStream is, File outputDir, Charset charset) {
unpack(is, outputDir, IdentityNameMapper.INSTANCE, charset);
}
代码示例来源:origin: org.zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
*/
public static void unpack(InputStream is, File outputDir, NameMapper mapper) {
unpack(is, outputDir, mapper, null);
}
代码示例来源:origin: molgenis/molgenis
public static void unzip(InputStream is, File outputDir) {
try {
ZipUtil.unpack(is, outputDir);
} catch (Exception ex) {
throw new UnzipException(ex);
}
}
代码示例来源:origin: PlayPen/playpen-core
@Override
public boolean runStep(P3Package p3, PackageContext ctx, JSONObject config) {
log.info("Expanding package to " + ctx.getDestination().getPath());
try {
ZipUtil.unpack(new File(p3.getLocalPath()), ctx.getDestination());
}
catch(ZipException e) {
log.error("Unable to expand package", e);
return false;
}
return true;
}
}
代码示例来源:origin: alexcojocaru/elasticsearch-maven-plugin
private File unpackToElasticsearchDirectory(File artifact, InstanceConfiguration config)
throws IOException
{
File unpackDirectory = getUnpackDirectory();
ZipUtil.unpack(artifact, unpackDirectory);
File baseDir = new File(config.getBaseDir());
moveToElasticsearchDirectory(unpackDirectory, baseDir);
return unpackDirectory;
}
代码示例来源:origin: molgenis/molgenis
/**
* Unzips a zipfile into the directory it resides in.
*
* @param file the zipfile to unzip
* @param nameMapper the {@link NameMapper} to use when unzipping
* @return List of Files that got extracted
* @throws UnzipException if something went wrong
*/
private static List<File> unzip(File file, NameMapper nameMapper) {
try {
File parentFile = file.getParentFile();
TrackingNameMapper trackingNameMapper = new TrackingNameMapper(parentFile, nameMapper);
ZipUtil.unpack(file, parentFile, trackingNameMapper);
return trackingNameMapper.getFiles();
} catch (Exception ex) {
throw new UnzipException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!