1. /*
  2. * @(#)JarEntry.java 1.13 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.util.jar;
  8. import java.io.IOException;
  9. import java.util.zip.ZipEntry;
  10. import java.security.cert.Certificate;
  11. /**
  12. * This class is used to represent a JAR file entry.
  13. */
  14. public
  15. class JarEntry extends ZipEntry {
  16. Attributes attr;
  17. Certificate[] certs;
  18. /**
  19. * Creates a new <code>JarEntry</code> for the specified JAR file
  20. * entry name.
  21. *
  22. * @param the JAR file entry name
  23. * @exception NullPointerException if the entry name is <code>null</code>
  24. * @exception IllegalArgumentException if the entry name is longer than
  25. * 0xFFFF bytes.
  26. */
  27. public JarEntry(String name) {
  28. super(name);
  29. }
  30. /**
  31. * Creates a new <code>JarEntry</code> with fields taken from the
  32. * specified <code>ZipEntry</code> object.
  33. */
  34. public JarEntry(ZipEntry ze) {
  35. super(ze);
  36. }
  37. /**
  38. * Creates a new <code>JarEntry</code> with fields taken from the
  39. * specified <code>JarEntry</code> object.
  40. *
  41. * @param je the <code>JarEntry</code> to copy
  42. */
  43. public JarEntry(JarEntry je) {
  44. this((ZipEntry)je);
  45. this.attr = je.attr;
  46. this.certs = je.certs;
  47. }
  48. /**
  49. * Returns the <code>Manifest</code> <code>Attributes</code> for this
  50. * entry, or <code>null</code> if none.
  51. */
  52. public Attributes getAttributes() throws IOException {
  53. return attr;
  54. }
  55. /**
  56. * Returns the <code>Certificate</code> objects for this entry, or
  57. * <code>null</code> if none. This method can only be called once
  58. * the <code>JarEntry</code> has been completely verified by reading
  59. * from the entry input stream until the end of the stream has been
  60. * reached. Otherwise, this method will return <code>null</code>.
  61. *
  62. * <p>The returned certificate array comprises all the signer certificates
  63. * that were used to verify this entry. Each signer certificate is
  64. * followed by its supporting certificate chain (which may be empty).
  65. * Each signer certificate and its supporting certificate chain are ordered
  66. * bottom-to-top (i.e., with the signer certificate first and the (root)
  67. * certificate authority last).
  68. */
  69. public Certificate[] getCertificates() {
  70. return certs;
  71. }
  72. }