java.util.jar

Class JarEntry

public class JarEntry extends ZipEntry

Extension to a ZipEntry that contains manifest attributes and certificates. Both the Atrributes and the Certificates can be null when not set. Note that the getCertificates() method only returns a valid value after all of the data of the entry has been read.

There are no public methods to set the attributes or certificate of an Entru. Only JarEntries created by the classes in java.util.jar will have these properties set.

Since: 1.2

Constructor Summary
JarEntry(String name)
Creates a new JarEntry with the specified name and no attributes or or certificates.
JarEntry(ZipEntry entry)
Creates a new JarEntry with the specified ZipEntry as template for all properties of the entry.
JarEntry(JarEntry entry)
Creates a new JarEntry with the specified JarEntry as template for all properties of the entry.
Method Summary
AttributesgetAttributes()
Returns a copy of the Attributes set for this entry.
Certificate[]getCertificates()
Returns a copy of the certificates set for this entry.

Constructor Detail

JarEntry

public JarEntry(String name)
Creates a new JarEntry with the specified name and no attributes or or certificates. Calls super(name) so all other (zip)entry fields are null or -1.

Parameters: name the name of the new jar entry

Throws: NullPointerException when the supplied name is null IllegalArgumentException when the supplied name is longer than 65535 bytes

JarEntry

public JarEntry(ZipEntry entry)
Creates a new JarEntry with the specified ZipEntry as template for all properties of the entry. Both attributes and certificates will be null.

Parameters: entry the ZipEntry whose fields should be copied

JarEntry

public JarEntry(JarEntry entry)
Creates a new JarEntry with the specified JarEntry as template for all properties of the entry.

Parameters: entry the jarEntry whose fields should be copied

Method Detail

getAttributes

public Attributes getAttributes()
Returns a copy of the Attributes set for this entry. When no Attributes are set in the manifest null is returned.

Returns: a copy of the Attributes set for this entry

Throws: IOException This will never be thrown. It is here for binary compatibility.

getCertificates

public Certificate[] getCertificates()
Returns a copy of the certificates set for this entry. When no certificates are set or when not all data of this entry has been read null is returned.

To make sure that this call returns a valid value you must read all data from the JarInputStream for this entry. When you don't need the data for an entry but want to know the certificates that are set for the entry then you can skip all data by calling skip(entry.getSize()) on the JarInputStream for the entry.

Returns: a copy of the certificates set for this entry