- java.lang.Object
-
- java.util.jar.Manifest
-
- All Implemented Interfaces:
-
Cloneable
public class Manifest extends Object implements Cloneable
- 从以下版本开始:
- 1.2
- 另请参见:
-
Attributes
-
-
构造方法摘要
构造方法 Constructor 描述 Manifest()构建一个新的,空的清单。Manifest(InputStream is)从指定的输入流构造一个新的清单。Manifest(Manifest man)构造一个新的清单,它是指定的清单的副本。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidclear()清除主要属性以及此清单中的条目。Objectclone()返回此清单的浅层副本。booleanequals(Object o)如果指定的对象也是清单并具有相同的主要属性和条目,则返回true。AttributesgetAttributes(String name)返回指定条目名称的属性。Map<String,Attributes>getEntries()返回此清单中包含的条目的地图。AttributesgetMainAttributes()返回清单的主要属性。inthashCode()返回此清单的哈希码。voidread(InputStream is)从指定的InputStream读取清单。voidwrite(OutputStream out)将清单写入指定的OutputStream。
-
-
-
构造方法详细信息
-
Manifest
public Manifest()
构建一个新的,空的清单。
-
Manifest
public Manifest(InputStream is) throws IOException
从指定的输入流构造一个新的清单。- 参数
-
is- 包含清单数据的输入流 - 异常
-
IOException- 如果发生I / O错误
-
Manifest
public Manifest(Manifest man)
构造一个新的清单,它是指定的清单的副本。- 参数
-
man- 要复制的清单
-
-
方法详细信息
-
getMainAttributes
public Attributes getMainAttributes()
返回清单的主要属性。- 结果
- 主要属性的清单
-
getEntries
public Map<String,Attributes> getEntries()
返回此清单中包含的条目的地图。 每个条目由字符串名称(键)和关联的属性(值)表示。 该地图允许null密钥,但是read(java.io.InputStream)创建了无空条目的条目,也不使用write(java.io.OutputStream)写入该条目。- 结果
- 该清单中包含的条目的地图
-
getAttributes
public Attributes getAttributes(String name)
返回指定条目名称的属性。 此方法定义为:return (Attributes)getEntries().get(name)虽然null是有效name,当getAttributes(null)是在调用Manifest从JAR文件中获得的,null将被退回。 虽然JAR文件本身不允许null-named属性,也可以调用getEntries()上Manifest,并且该结果,调用put用null键和任意值。 随后的getAttributes(null)调用将返回put值。请注意,此方法不返回清单的主要属性; 见
getMainAttributes()。- 参数
-
name- 条目名称 - 结果
- 指定条目名称的属性
-
clear
public void clear()
清除主要属性以及此清单中的条目。
-
write
public void write(OutputStream out) throws IOException
将清单写入指定的OutputStream。 在调用此方法之前,必须在MainAttributes中设置Attributes.Name.MANIFEST_VERSION。- 参数
-
out- 输出流 - 异常
-
IOException- 如果发生I / O错误 - 另请参见:
-
getMainAttributes()
-
read
public void read(InputStream is) throws IOException
从指定的InputStream读取清单。 读取的条目名称和属性将与当前清单条目合并。- 参数
-
is- 输入流 - 异常
-
IOException- 如果发生I / O错误
-
equals
public boolean equals(Object o)
如果指定的对象也是清单并具有相同的主要属性和条目,则返回true。- 重写:
-
equals在Object - 参数
-
o- 要比较的对象 - 结果
- 如果指定的对象也是清单并具有相同的主要属性和条目,则为true
- 另请参见:
-
Object.hashCode(),HashMap
-
hashCode
public int hashCode()
返回此清单的哈希码。- 重写:
-
hashCode在Object - 结果
- 该对象的哈希码值。
- 另请参见:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
-