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