0N/A/*
2362N/A * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.util.jar;
0N/A
0N/Aimport java.io.IOException;
0N/Aimport java.util.zip.ZipEntry;
0N/Aimport java.security.CodeSigner;
0N/Aimport java.security.cert.Certificate;
0N/A
0N/A/**
0N/A * This class is used to represent a JAR file entry.
0N/A */
0N/Apublic
0N/Aclass JarEntry extends ZipEntry {
0N/A Attributes attr;
0N/A Certificate[] certs;
0N/A CodeSigner[] signers;
0N/A
0N/A /**
0N/A * Creates a new <code>JarEntry</code> for the specified JAR file
0N/A * entry name.
0N/A *
0N/A * @param name the JAR file entry name
0N/A * @exception NullPointerException if the entry name is <code>null</code>
0N/A * @exception IllegalArgumentException if the entry name is longer than
0N/A * 0xFFFF bytes.
0N/A */
0N/A public JarEntry(String name) {
0N/A super(name);
0N/A }
0N/A
0N/A /**
0N/A * Creates a new <code>JarEntry</code> with fields taken from the
0N/A * specified <code>ZipEntry</code> object.
0N/A * @param ze the <code>ZipEntry</code> object to create the
0N/A * <code>JarEntry</code> from
0N/A */
0N/A public JarEntry(ZipEntry ze) {
0N/A super(ze);
0N/A }
0N/A
0N/A /**
0N/A * Creates a new <code>JarEntry</code> with fields taken from the
0N/A * specified <code>JarEntry</code> object.
0N/A *
0N/A * @param je the <code>JarEntry</code> to copy
0N/A */
0N/A public JarEntry(JarEntry je) {
0N/A this((ZipEntry)je);
0N/A this.attr = je.attr;
0N/A this.certs = je.certs;
0N/A this.signers = je.signers;
0N/A }
0N/A
0N/A /**
0N/A * Returns the <code>Manifest</code> <code>Attributes</code> for this
0N/A * entry, or <code>null</code> if none.
0N/A *
0N/A * @return the <code>Manifest</code> <code>Attributes</code> for this
0N/A * entry, or <code>null</code> if none
0N/A */
0N/A public Attributes getAttributes() throws IOException {
0N/A return attr;
0N/A }
0N/A
0N/A /**
0N/A * Returns the <code>Certificate</code> objects for this entry, or
0N/A * <code>null</code> if none. This method can only be called once
0N/A * the <code>JarEntry</code> has been completely verified by reading
0N/A * from the entry input stream until the end of the stream has been
0N/A * reached. Otherwise, this method will return <code>null</code>.
0N/A *
0N/A * <p>The returned certificate array comprises all the signer certificates
0N/A * that were used to verify this entry. Each signer certificate is
0N/A * followed by its supporting certificate chain (which may be empty).
0N/A * Each signer certificate and its supporting certificate chain are ordered
0N/A * bottom-to-top (i.e., with the signer certificate first and the (root)
0N/A * certificate authority last).
0N/A *
0N/A * @return the <code>Certificate</code> objects for this entry, or
0N/A * <code>null</code> if none.
0N/A */
0N/A public Certificate[] getCertificates() {
0N/A return certs == null ? null : certs.clone();
0N/A }
0N/A
0N/A /**
0N/A * Returns the <code>CodeSigner</code> objects for this entry, or
0N/A * <code>null</code> if none. This method can only be called once
0N/A * the <code>JarEntry</code> has been completely verified by reading
0N/A * from the entry input stream until the end of the stream has been
0N/A * reached. Otherwise, this method will return <code>null</code>.
0N/A *
0N/A * <p>The returned array comprises all the code signers that have signed
0N/A * this entry.
0N/A *
0N/A * @return the <code>CodeSigner</code> objects for this entry, or
0N/A * <code>null</code> if none.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public CodeSigner[] getCodeSigners() {
0N/A return signers == null ? null : signers.clone();
0N/A }
0N/A}