本文整理了Java中org.apache.tools.zip.ZipFile.closeQuietly()
方法的一些代码示例,展示了ZipFile.closeQuietly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFile.closeQuietly()
方法的具体详情如下:
包路径:org.apache.tools.zip.ZipFile
类名称:ZipFile
方法名:closeQuietly
[英]close a zipfile quietly; throw no io fault, do nothing on a null parameter
[中]轻轻地合上拉链;不抛出io错误,对空参数不执行任何操作
代码示例来源:origin: org.apache.ant/ant
/**
* fetches information from the named entry inside the archive.
*/
protected void fetchEntry() {
ZipFile z = null;
try {
z = new ZipFile(getZipfile(), getEncoding());
setEntry(z.getEntry(getName()));
} catch (IOException e) {
log(e.getMessage(), Project.MSG_DEBUG);
throw new BuildException(e);
} finally {
ZipFile.closeQuietly(z);
}
}
代码示例来源:origin: org.apache.ant/ant
} finally {
FileUtils.close(inputStream);
ZipFile.closeQuietly(zf);
代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks
public static void unzipToDirectory(File file, File destDir) throws IOException {
ZipFile zipFile = new ZipFile(file);
try {
unzipToDirectory(zipFile, destDir);
} finally {
ZipFile.closeQuietly(zipFile);
}
}
代码示例来源:origin: HuaweiBigData/StreamCQL
private void checkJarContext(String filePath, File file)
throws CQLException
{
ZipFile zipFile = null;
try
{
/*
* 检查文件类型是否是zip文件,ANT中会自动进行检查,无需解压缩
*/
zipFile = new ZipFile(file, ENCODING, true);
}
catch (FileNotFoundException e)
{
CQLException exception = new CQLException(ErrorCode.SEMANTICANALYZE_FILE_NOT_EXISTS, filePath);
LOG.error("File does not exists.", exception);
throw exception;
}
catch (IOException e)
{
CQLException exception = new CQLException(ErrorCode.SEMANTICANALYZE_FILE_NOT_JAR, filePath);
LOG.error("File not a jar type.", exception);
throw exception;
}
finally
{
ZipFile.closeQuietly(zipFile);
}
}
内容来源于网络,如有侵权,请联系作者删除!