本文整理了Java中java.util.jar.Manifest.equals()
方法的一些代码示例,展示了Manifest.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Manifest.equals()
方法的具体详情如下:
包路径:java.util.jar.Manifest
类名称:Manifest
方法名:equals
[英]Determines if the receiver is equal to the parameter object. Two Manifests are equal if they have identical main attributes as well as identical entry attributes.
[中]确定接收器是否等于参数对象。如果两个清单具有相同的主属性以及相同的条目属性,则它们是相等的。
代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub
@Override
public final boolean equals(final Object o) {
if (o instanceof JogampVersion) {
return mf.equals(((JogampVersion) o).getManifest());
}
return false;
}
代码示例来源:origin: tterrag1098/BON2
@Override
public boolean equals(Object o) {
if(this == o) {
return true;
}
if(o == null || getClass() != o.getClass()) {
return false;
}
ClassCollection that = (ClassCollection)o;
if(classes != null ? !classes.equals(that.classes) : that.classes != null) {
return false;
}
if(extraFiles != null ? !extraFiles.equals(that.extraFiles) : that.extraFiles != null) {
return false;
}
if(manifest != null ? !manifest.equals(that.manifest) : that.manifest != null) {
return false;
}
return true;
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) {
JarFile jar = null;
try {
jar = new JarFile("plugin.jar");
} catch (IOException e) {
e.printStackTrace();
}
ZipFile zipFile = null;
try {
zipFile = new ZipFile("plugin.jar");
} catch (IOException e) {
e.printStackTrace();
}
final ZipEntry manifestEntry = zipFile.getEntry("META-INF/MANIFEST.MF");
Manifest smActual = null;
Manifest smExpected = null;
try {
smActual = new Manifest(jar.getInputStream(manifestEntry));
smExpected = new Manifest(new FileInputStream("META-INF/MANIFEST.MF"));
} catch (IOException e) {
e.printStackTrace();
}
if(smActual.equals(smExpected)) {
System.out.println("Yes Equal");
} else {
System.out.println("They are not equal");
}
}
内容来源于网络,如有侵权,请联系作者删除!