public class Manifest
extends Object implements Cloneable
| java.lang.Object | |
| java.util.jar.Manifest | |
Manifest类用于维护清单条目名称及其关联的属性。 主要的Manifest属性以及每个条目的属性。 有关清单格式的信息,请参阅Manifest format specification 。
也可以看看:
Public constructors |
|
|---|---|
Manifest() 构造一个新的空Manifest。 |
|
Manifest(InputStream is) 从指定的输入流构造一个新的Manifest。 |
|
Manifest(Manifest man) 构造一个新Manifest,它是指定Manifest的副本。 |
|
公共方法(Public methods) |
|
|---|---|
void |
clear() 清除主要属性以及此清单中的条目。 |
Object |
clone() 返回此Manifest的浅表副本。 |
boolean |
equals(Object o) 如果指定的Object也是一个Manifest并且具有相同的主属性和条目,则返回true。 |
Attributes |
getAttributes(String name) 返回指定条目名称的属性。 |
Map<String, Attributes> |
getEntries() 返回此Manifest中包含的条目的映射。 |
Attributes |
getMainAttributes() 返回Manifest的主要属性。 |
int |
hashCode() 返回此Manifest的哈希码。 |
void |
read(InputStream is) 从指定的InputStream中读取Manifest。 |
void |
write(OutputStream out) 将Manifest写入指定的OutputStream。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
Manifest (InputStream is)
从指定的输入流构造一个新的Manifest。
| 参数(Parameters) | |
|---|---|
is |
InputStream: the input stream containing manifest data |
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error has occured |
Manifest (Manifest man)
构造一个新Manifest,它是指定Manifest的副本。
| 参数(Parameters) | |
|---|---|
man |
Manifest: the Manifest to copy |
Object clone ()
返回此Manifest的浅表副本。 浅拷贝的实现如下:
public Object clone() { return new Manifest(this); }
| 返回(Returns) | |
|---|---|
Object |
a shallow copy of this Manifest |
boolean equals (Object o)
如果指定的Object也是一个Manifest并且具有相同的主属性和条目,则返回true。
| 参数(Parameters) | |
|---|---|
o |
Object: the object to be compared |
| 返回(Returns) | |
|---|---|
boolean |
true if the specified Object is also a Manifest and has the same main Attributes and entries |
Attributes getAttributes (String name)
返回指定条目名称的属性。 这种方法被定义为:
return (Attributes)getEntries().get(name)Though
null is a valid
name, when
getAttributes(null) is invoked on a
Manifest obtained from a jar file,
null will be returned. While jar files themselves do not allow
null-named attributes, it is possible to invoke
getEntries() on a
Manifest, and on that result, invoke
put with a null key and an arbitrary value. Subsequent invocations of
getAttributes(null) will return the just-
put value.
请注意,此方法不会返回清单的主要属性; 见getMainAttributes() 。
| 参数(Parameters) | |
|---|---|
name |
String: entry name |
| 返回(Returns) | |
|---|---|
Attributes |
the Attributes for the specified entry name |
Map<String, Attributes> getEntries ()
返回此Manifest中包含的条目的映射。 每个条目由一个字符串名称(键)和关联的属性(值)表示。 该映射允许null键,但没有空键的条目由read(InputStream)创建,也不是使用write(OutputStream)写入的这样的条目。
| 返回(Returns) | |
|---|---|
Map<String, Attributes> |
a Map of the entries contained in this Manifest |
Attributes getMainAttributes ()
返回Manifest的主要属性。
| 返回(Returns) | |
|---|---|
Attributes |
the main Attributes for the Manifest |
int hashCode ()
返回此Manifest的哈希码。
| 返回(Returns) | |
|---|---|
int |
a hash code value for this object. |
void read (InputStream is)
从指定的InputStream中读取Manifest。 读取的条目名称和属性将与当前清单条目合并。
| 参数(Parameters) | |
|---|---|
is |
InputStream: the input stream |
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error has occurred |
void write (OutputStream out)
将Manifest写入指定的OutputStream。 在调用此方法之前,必须在MainAttributes中设置Attributes.Name.MANIFEST_VERSION。
| 参数(Parameters) | |
|---|---|
out |
OutputStream: the output stream |
| 抛出异常(Throws) | |
|---|---|
IOException |
if an I/O error has occurred |
也可以看看: