Class Manifest.Attribute

java.lang.Object
org.codehaus.plexus.archiver.jar.Manifest.BaseAttribute
org.codehaus.plexus.archiver.jar.Manifest.Attribute
All Implemented Interfaces:
Iterable<String>
Direct Known Subclasses:
Manifest.ExistingAttribute
Enclosing class:
Manifest

public static class Manifest.Attribute extends Manifest.BaseAttribute implements Iterable<String>
An attribute for the manifest. Those attributes that are not nested into a section will be added to the "Main" section.
  • Field Details

    • values

      private Vector<String> values
      The attribute's value
    • currentIndex

      private int currentIndex
      For multivalued attributes, this is the index of the attribute currently being defined.
  • Constructor Details

    • Attribute

      public Attribute()
      Construct an empty attribute
    • Attribute

      public Attribute(String name, String value)
      Construct a manifest by specifying its name and value
      Parameters:
      name - the attribute's name
      value - the Attribute's value
  • Method Details

    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Manifest.BaseAttribute
      See Also:
    • equals

      public boolean equals(Object rhs)
      Overrides:
      equals in class Manifest.BaseAttribute
      See Also:
    • setName

      public void setName(String name)
      Set the Attribute's name; required
      Parameters:
      name - the attribute's name
    • getKey

      public String getKey()
      Get the attribute's Key - its name in lower case.
      Returns:
      the attribute's key.
    • getKey

      private static String getKey(String name)
      Get the key for the specified attribute name - its name in lower case.
      Returns:
      the attribute's key.
    • setValue

      public void setValue(String value)
      Set the Attribute's value; required
      Parameters:
      value - the attribute's value
    • getValue

      public String getValue()
      Get the Attribute's value.
      Returns:
      the attribute's value.
    • addValue

      public void addValue(String value)
      Add a new value to this attribute - making it multivalued.
      Parameters:
      value - the attribute's additional value
    • write

      void write(Writer writer) throws IOException
      Writes the attribute out to a writer.
      Parameters:
      writer - the Writer to which the attribute is written
      Throws:
      IOException - if the attribute value cannot be written
    • writeValue

      private void writeValue(Writer writer, String value) throws IOException
      Write a single attribute value out. Should handle multiple lines of attribute value.
      Parameters:
      writer - the Writer to which the attribute is written
      value - the attribute value
      Throws:
      IOException - if the attribute value cannot be written
    • writeLine

      private void writeLine(Writer writer, String line) throws IOException
      Write a single Manifest line. Should handle more than 72 bytes of line
      Parameters:
      writer - the Writer to which the attribute is written
      line - the manifest line to be written
      Throws:
      IOException - when Io excepts