Source Home >> Java Source 1.6.0 >> java.util.jar.JarEntry V 0.09
  • 001/*
  • 002 * @(#)JarEntry.java 1.23 05/11/30
  • 003 *
  • 004 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
  • 005 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  • 006 */
  • 007
  • 008package java.util.jar;
  • 009
  • 010import java.io.IOException;
  • 011import java.util.zip.ZipEntry;
  • 012import java.security.CodeSigner;
  • 013import java.security.cert.Certificate;
  • 014
  • 015/**
  • 016 * This class is used to represent a JAR file entry.
  • 017 */
  • 018public
  • 019class JarEntry extends ZipEntry {
  • 020 Attributes attr;
  • 021 Certificate[] certs;
  • 022 CodeSigner[] signers;
  • 023
  • 024 /**
  • 025 * Creates a new <code>JarEntry</code> for the specified JAR file
  • 026 * entry name.
  • 027 *
  • 028 * @param name the JAR file entry name
  • 029 * @exception NullPointerException if the entry name is <code>null</code>
  • 030 * @exception IllegalArgumentException if the entry name is longer than
  • 031 * 0xFFFF bytes.
  • 032 */
  • 033 public JarEntry(String name) {
  • 034 super(name);
  • 035 }
  • 036
  • 037 /**
  • 038 * Creates a new <code>JarEntry</code> with fields taken from the
  • 039 * specified <code>ZipEntry</code> object.
  • 040 * @param ze the <code>ZipEntry</code> object to create the
  • 041 * <code>JarEntry</code> from
  • 042 */
  • 043 public JarEntry(ZipEntry ze) {
  • 044 super(ze);
  • 045 }
  • 046
  • 047 /**
  • 048 * Creates a new <code>JarEntry</code> with fields taken from the
  • 049 * specified <code>JarEntry</code> object.
  • 050 *
  • 051 * @param je the <code>JarEntry</code> to copy
  • 052 */
  • 053 public JarEntry(JarEntry je) {
  • 054 this((ZipEntry)je);
  • 055 this.attr = je.attr;
  • 056 this.certs = je.certs;
  • 057 this.signers = je.signers;
  • 058 }
  • 059
  • 060 /**
  • 061 * Returns the <code>Manifest</code> <code>Attributes</code> for this
  • 062 * entry, or <code>null</code> if none.
  • 063 *
  • 064 * @return the <code>Manifest</code> <code>Attributes</code> for this
  • 065 * entry, or <code>null</code> if none
  • 066 */
  • 067 public Attributes getAttributes() throws IOException {
  • 068 return attr;
  • 069 }
  • 070
  • 071 /**
  • 072 * Returns the <code>Certificate</code> objects for this entry, or
  • 073 * <code>null</code> if none. This method can only be called once
  • 074 * the <code>JarEntry</code> has been completely verified by reading
  • 075 * from the entry input stream until the end of the stream has been
  • 076 * reached. Otherwise, this method will return <code>null</code>.
  • 077 *
  • 078 * <p>The returned certificate array comprises all the signer certificates
  • 079 * that were used to verify this entry. Each signer certificate is
  • 080 * followed by its supporting certificate chain (which may be empty).
  • 081 * Each signer certificate and its supporting certificate chain are ordered
  • 082 * bottom-to-top (i.e., with the signer certificate first and the (root)
  • 083 * certificate authority last).
  • 084 *
  • 085 * @return the <code>Certificate</code> objects for this entry, or
  • 086 * <code>null</code> if none.
  • 087 */
  • 088 public Certificate[] getCertificates() {
  • 089 return certs == null ? null : (Certificate[]) certs.clone();
  • 090 }
  • 091
  • 092 /**
  • 093 * Returns the <code>CodeSigner</code> objects for this entry, or
  • 094 * <code>null</code> if none. This method can only be called once
  • 095 * the <code>JarEntry</code> has been completely verified by reading
  • 096 * from the entry input stream until the end of the stream has been
  • 097 * reached. Otherwise, this method will return <code>null</code>.
  • 098 *
  • 099 * <p>The returned array comprises all the code signers that have signed
  • 100 * this entry.
  • 101 *
  • 102 * @return the <code>CodeSigner</code> objects for this entry, or
  • 103 * <code>null</code> if none.
  • 104 *
  • 105 * @since 1.5
  • 106 */
  • 107 public CodeSigner[] getCodeSigners() {
  • 108 return signers == null ? null : (CodeSigner[]) signers.clone();
  • 109 }
  • 110}

文件:JarEntry.java
包名:java.util.jar
类名:JarEntry
继承:ZipEntry
接口: