站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Platform, Enterprise Edition v1.4 API Specifications

ParameterList (Java 2 Platform Ent. Ed. v1.4) - Java Platform, Enterprise Edition v1.4 API Specifications

JavaTM 2 Platform
Ent. Ed. v1.4

javax.mail.internet
Class ParameterList

java.lang.Object
  extended byjavax.mail.internet.ParameterList

public class ParameterList
extends Object

This class holds MIME parameters (attribute-value pairs).

Version:
1.10, 03/02/12
Author:
John Mani

Constructor Summary
ParameterList()
          No-arg Constructor.
ParameterList(String s)
          Constructor that takes a parameter-list string.
 
Method Summary
 String get(String name)
          Returns the value of the specified parameter.
 Enumeration getNames()
          Return an enumeration of the names of all parameters in this list.
 void remove(String name)
          Removes the specified parameter from this ParameterList.
 void set(String name, String value)
          Set a parameter.
 int size()
          Return the number of parameters in this list.
 String toString()
          Convert this ParameterList into a MIME String.
 String toString(int used)
          Convert this ParameterList into a MIME String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterList

public ParameterList()
No-arg Constructor.


ParameterList

public ParameterList(String s)
              throws ParseException
Constructor that takes a parameter-list string. The String is parsed and the parameters are collected and stored internally. A ParseException is thrown if the parse fails. Note that an empty parameter-list string is valid and will be parsed into an empty ParameterList.

Parameters:
s - the parameter-list string.
Throws:
ParseException - if the parse fails.
Method Detail

size

public int size()
Return the number of parameters in this list.

Returns:
number of parameters.

get

public String get(String name)
Returns the value of the specified parameter. Note that parameter names are case-insensitive.

Parameters:
name - parameter name.
Returns:
Value of the parameter. Returns null if the parameter is not present.

set

public void set(String name,
                String value)
Set a parameter. If this parameter already exists, it is replaced by this new value.

Parameters:
name - name of the parameter.
value - value of the parameter.

remove

public void remove(String name)
Removes the specified parameter from this ParameterList. This method does nothing if the parameter is not present.

Parameters:
name - name of the parameter.

getNames

public Enumeration getNames()
Return an enumeration of the names of all parameters in this list.

Returns:
Enumeration of all parameter names in this list.

toString

public String toString()
Convert this ParameterList into a MIME String. If this is an empty list, an empty string is returned.

Returns:
String

toString

public String toString(int used)
Convert this ParameterList into a MIME String. If this is an empty list, an empty string is returned. The 'used' parameter specifies the number of character positions already taken up in the field into which the resulting parameter list is to be inserted. It's used to determine where to fold the resulting parameter list.

Parameters:
used - number of character positions already used, in the field into which the parameter list is to be inserted.
Returns:
String

JavaTM 2 Platform
Ent. Ed. v1.4

Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.