com.hunnysoft.jmime
Class Parameter

java.lang.Object
  extended bycom.hunnysoft.jmime.Node
      extended bycom.hunnysoft.jmime.Parameter
All Implemented Interfaces:
java.lang.Cloneable

public class Parameter
extends Node

Class that represents a MIME header field parameter.

Parameter represents a parameter in a header field body, such as the field body of a Content-Type header field. The syntax of such a parameter is described in RFC 2045. A parameter consists of a name/value pair. The following Content-Type header field illustrates the syntax:

    Content-type: text/plain; charset=iso-8859-1; format=flowed

In the above example, there are two parameters. The first parameter has the name "charset" and the value "iso-8859-1". The second parameter has the name "format" and value "flowed".

Parameter has methods for getting or setting the parameter's name and value.


Field Summary
 
Fields inherited from class com.hunnysoft.jmime.Node
mIsModified, mParent, mString
 
Constructor Summary
Parameter()
          Default constructor.
Parameter(ByteString bstr)
          Constructor that takes an initial byte string argument.
Parameter(Parameter other)
          Copy constructor.
 
Method Summary
 void assemble()
          Assembles the string representation.
 java.lang.Object clone()
          Creates a copy of this object.
 java.lang.String name()
          Gets the parameter name
 void parse()
          Parses the string representation.
 void setName(java.lang.String name)
          Sets the parameter name
 void setValue(java.lang.String value)
          Sets the parameter value
 java.lang.String value()
          Gets the parameter value
 
Methods inherited from class com.hunnysoft.jmime.Node
_setString, isModified, parent, setModified, setParent, setString, string, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Parameter

public Parameter()
Default constructor.

This constructor sets the Parameter object's string representation to the empty string and sets its parent node to null. The name and value are both set to the empty string.


Parameter

public Parameter(Parameter other)
Copy constructor.

This constructor performs a deep copy of its argument. The parent node of the new Parameter object is set to null.

Parameters:
other - Parameter instance to copy

Parameter

public Parameter(ByteString bstr)
Constructor that takes an initial byte string argument.

This constructor sets the Parameter object's string representation to bstr and sets its parent node to null.

Normally, you call the parse() method immediately after this constructor to create the broken-down representation.

Parameters:
bstr - initial value for the string representation
Method Detail

clone

public java.lang.Object clone()
Creates a copy of this object.

This method, inherited from Object, creates a new Parameter object that has the same value as this Parameter object. The parent node of the new Parameter object is set to null.

Overrides:
clone in class Node
Returns:
a copy of this object

parse

public void parse()
Parses the string representation.

This method, inherited from Node, executes the parse operation for Parameter objects. The parse operation updates the broken-down representation from the string representation. For Parameter objects, the parse operation parses the string representation to extract the name and value of the parameter.

You should call this method after you set or modify the string representation, and before you retrieve the name or value.

This method clears the is-modified flag.

Specified by:
parse in class Node
See Also:
Node.assemble()

assemble

public void assemble()
Assembles the string representation.

This method, inherited from Node, executes the assemble operation for Parameter objects. The assemble operation creates or updates the string representation from the broken-down representation. For Parameter objects, the assemble operation builds the string representation from the name and value.

You should call this method after you set or modify the name or value, and before you retrieve the string representation.

This method clears the is-modified flag.

Specified by:
assemble in class Node
See Also:
Node.parse()

name

public java.lang.String name()
Gets the parameter name

Returns:
parameter name

setName

public void setName(java.lang.String name)
Sets the parameter name

Parameters:
name - parameter name

value

public java.lang.String value()
Gets the parameter value

Returns:
parameter value

setValue

public void setValue(java.lang.String value)
Sets the parameter value

Parameters:
value - parameter value