JarEntry

JarEntry objects represent files stored inside a JAR archive. JarEntry is a subclass of java.util.zip.ZipEntry, and JarEntry objects are almost exactly like ZipEntry objects.

public class JarEntry extends ZipEntry

JarEntry has three constructors:

public JarEntry(String filename) public JarEntry(ZipEntry entry) public JarEntry(JarEntry entry)

You might use the first one if you were creating a JAR file from scratch, though that's rare. The other two are mainly for Java's internal use to allow the internal state of one JarEntry object to be quickly copied to a new JarEntry object.

JarEntry does not override any methods from ZipEntry. It inherits all of ZipEntry's assorted getter and setter and utility methods. It also provides two new methods:

public Attributes getAttributes( ) throws IOException public Certificate[] getCertificates( )

The getAttributes( ) method returns the attributes for this entry as documented in the manifest file of the archive. In brief, an Attributes object is a map of the name/value pairs for the entry. This will be discussed further in the next section. The getCertificates( ) method returns an array of java.security.cert.Certificate objects formed from any signature files for this entry stored in the archive. These can be used to allow some classes more access to the system than they would normally get.

Категории