- java.lang.Object
-
- java.util.jar.Manifest
-
- All Implemented Interfaces:
- Cloneable
public class Manifest extends Object implements Cloneable
The Manifest class is used to maintain Manifest entry names and their associated Attributes. There are main Manifest Attributes as well as per-entry Attributes. For information on the Manifest format, please see the Manifest format specification.- Since:
- 1.2
- See Also:
Attributes
-
-
Constructor Summary
Constructors Constructor and Description Manifest()
Constructs a new, empty Manifest.Manifest(InputStream is)
Constructs a new Manifest from the specified input stream.Manifest(Manifest man)
Constructs a new Manifest that is a copy of the specified Manifest.
-
Method Summary
Methods Modifier and Type Method and Description void
clear()
Clears the main Attributes as well as the entries in this Manifest.Object
clone()
Returns a shallow copy of this Manifest.boolean
equals(Object o)
Returns true if the specified Object is also a Manifest and has the same main Attributes and entries.Attributes
getAttributes(String name)
Returns the Attributes for the specified entry name.Map<String,Attributes>
getEntries()
Returns a Map of the entries contained in this Manifest.Attributes
getMainAttributes()
Returns the main Attributes for the Manifest.int
hashCode()
Returns the hash code for this Manifest.void
read(InputStream is)
Reads the Manifest from the specified InputStream.void
write(OutputStream out)
Writes the Manifest to the specified OutputStream.
-
-
-
Constructor Detail
-
Manifest
public Manifest()
Constructs a new, empty Manifest.
-
Manifest
public Manifest(InputStream is) throws IOException
Constructs a new Manifest from the specified input stream.- Parameters:
is
- the input stream containing manifest data- Throws:
IOException
- if an I/O error has occured
-
Manifest
public Manifest(Manifest man)
Constructs a new Manifest that is a copy of the specified Manifest.- Parameters:
man
- the Manifest to copy
-
-
Method Detail
-
getMainAttributes
public Attributes getMainAttributes()
Returns the main Attributes for the Manifest.- Returns:
- the main Attributes for the Manifest
-
getEntries
public Map<String,Attributes> getEntries()
Returns a Map of the entries contained in this Manifest. Each entry is represented by a String name (key) and associated Attributes (value). The Map permits thenull
key, but no entry with a null key is created byread(java.io.InputStream)
, nor is such an entry written by usingwrite(java.io.OutputStream)
.- Returns:
- a Map of the entries contained in this Manifest
-
getAttributes
public Attributes getAttributes(String name)
Returns the Attributes for the specified entry name. This method is defined as:return (Attributes)getEntries().get(name)
Thoughnull
is a validname
, whengetAttributes(null)
is invoked on aManifest
obtained from a jar file,null
will be returned. While jar files themselves do not allownull
-named attributes, it is possible to invokegetEntries()
on aManifest
, and on that result, invokeput
with a null key and an arbitrary value. Subsequent invocations ofgetAttributes(null)
will return the just-put
value.Note that this method does not return the manifest's main attributes; see
getMainAttributes()
.- Parameters:
name
- entry name- Returns:
- the Attributes for the specified entry name
-
clear
public void clear()
Clears the main Attributes as well as the entries in this Manifest.
-
write
public void write(OutputStream out) throws IOException
Writes the Manifest to the specified OutputStream. Attributes.Name.MANIFEST_VERSION must be set in MainAttributes prior to invoking this method.- Parameters:
out
- the output stream- Throws:
IOException
- if an I/O error has occurred- See Also:
getMainAttributes()
-
read
public void read(InputStream is) throws IOException
Reads the Manifest from the specified InputStream. The entry names and attributes read will be merged in with the current manifest entries.- Parameters:
is
- the input stream- Throws:
IOException
- if an I/O error has occurred
-
equals
public boolean equals(Object o)
Returns true if the specified Object is also a Manifest and has the same main Attributes and entries.- Overrides:
equals
in classObject
- Parameters:
o
- the object to be compared- Returns:
- true if the specified Object is also a Manifest and has the same main Attributes and entries
- See Also:
Object.hashCode()
,HashMap
-
hashCode
public int hashCode()
Returns the hash code for this Manifest.- Overrides:
hashCode
in classObject
- Returns:
- a hash code value for this object.
- See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
05/11/2024 00:43:52 Cette version de la page est en cache (à la date du 05/11/2024 00:43:52) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/util/jar/manifest.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.