    001    /*
    002     * Licensed to the Apache Software Foundation (ASF) under one
    003     * or more contributor license agreements.  See the NOTICE file
    004     * distributed with this work for additional information
    005     * regarding copyright ownership.  The ASF licenses this file
    006     * to you under the Apache License, Version 2.0 (the
    007     * "License"); you may not use this file except in compliance
    008     * with the License.  You may obtain a copy of the License at
    009     *
    010     * http://www.apache.org/licenses/LICENSE-2.0
    011     *
    012     * Unless required by applicable law or agreed to in writing,
    013     * software distributed under the License is distributed on an
    014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    015     * KIND, either express or implied.  See the License for the
    016     * specific language governing permissions and limitations
    017     * under the License.
    018     */
    019    package org.apache.commons.compress.archivers.jar;
    020
    021    import java.security.cert.Certificate;
    022    import java.util.jar.Attributes;
    023    import java.util.jar.JarEntry;
    024    import java.util.zip.ZipEntry;
    025    import java.util.zip.ZipException;
    026
    027    import org.apache.commons.compress.archivers.ArchiveEntry;
    028    import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
    029
    030    /**
    031     *
    032     * @NotThreadSafe
    033     */
    034    public class JarArchiveEntry extends ZipArchiveEntry implements ArchiveEntry {
    035
    036        private Attributes manifestAttributes = null;
    037        private Certificate[] certificates = null;
    038
    039        public JarArchiveEntry(ZipEntry entry) throws ZipException {
    040            super(entry);
    041        }
    042
    043        public JarArchiveEntry(String name) {
    044            super(name);
    045        }
    046
    047        public JarArchiveEntry(ZipArchiveEntry entry) throws ZipException {
    048            super(entry);
    049        }
    050
    051        public JarArchiveEntry(JarEntry entry) throws ZipException {
    052            super(entry);
    053
    054        }
    055
    056        public Attributes getManifestAttributes() {
    057            return manifestAttributes;
    058        }
    059
    060        public Certificate[] getCertificates() {
    061                if (certificates != null) {
    062                    Certificate[] certs = new Certificate[certificates.length];
    063                    System.arraycopy(certificates, 0, certs, 0, certs.length);
    064                    return certs;
    065                }
    066                return null;
    067        }
    068
    069    }