1. /*
  2. * @(#)JarEntry.java 1.19 03/01/23
  3. *
  4. * Copyright 2003 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 name 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. * @param ze the <code>ZipEntry</code> object to create the
  34. * <code>JarEntry</code> from
  35. */
  36. public JarEntry(ZipEntry ze) {
  37. super(ze);
  38. }
  39. /**
  40. * Creates a new <code>JarEntry</code> with fields taken from the
  41. * specified <code>JarEntry</code> object.
  42. *
  43. * @param je the <code>JarEntry</code> to copy
  44. */
  45. public JarEntry(JarEntry je) {
  46. this((ZipEntry)je);
  47. this.attr = je.attr;
  48. this.certs = je.certs;
  49. }
  50. /**
  51. * Returns the <code>Manifest</code> <code>Attributes</code> for this
  52. * entry, or <code>null</code> if none.
  53. *
  54. * @return the <code>Manifest</code> <code>Attributes</code> for this
  55. * entry, or <code>null</code> if none
  56. */
  57. public Attributes getAttributes() throws IOException {
  58. return attr;
  59. }
  60. /**
  61. * Returns the <code>Certificate</code> objects for this entry, or
  62. * <code>null</code> if none. This method can only be called once
  63. * the <code>JarEntry</code> has been completely verified by reading
  64. * from the entry input stream until the end of the stream has been
  65. * reached. Otherwise, this method will return <code>null</code>.
  66. *
  67. * <p>The returned certificate array comprises all the signer certificates
  68. * that were used to verify this entry. Each signer certificate is
  69. * followed by its supporting certificate chain (which may be empty).
  70. * Each signer certificate and its supporting certificate chain are ordered
  71. * bottom-to-top (i.e., with the signer certificate first and the (root)
  72. * certificate authority last).
  73. *
  74. * @return the <code>Certificate</code> objects for this entry, or
  75. * <code>null</code> if none.
  76. */
  77. public Certificate[] getCertificates() {
  78. return certs;
  79. }
  80. }