ParameterList (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.mail.internet Class ParameterList

java.lang.Object
  extended by javax.mail.internet.ParameterList

public class ParameterList
extends Object

This class holds MIME parameters (attribute-value pairs). The mail.mime.encodeparameters and mail.mime.decodeparameters System properties control whether encoded parameters, as specified by RFC 2231, are supported. By default, such encoded parameters are not supported.

Also, in the current implementation, setting the System property mail.mime.decodeparameters.strict to "true" will cause a ParseException to be thrown for errors detected while decoding encoded parameters. By default, if any decoding errors occur, the original (undecoded) string is used.

版本:
1.17, 07/05/04
作者:
John Mani, Bill Shannon

构造器摘要
ParameterList()
          No-arg Constructor.
ParameterList(String s)
          Constructor that takes a parameter-list string.
 
方法摘要
 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.
 void set(String name, String value, String charset)
          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.
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造器详细信息

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.

参数:
s - the parameter-list string.
抛出异常:
ParseException - if the parse fails.

方法详细信息

size

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

返回:
number of parameters.

get

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

参数:
name - parameter name.
返回:
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.

参数:
name - name of the parameter.
value - value of the parameter.

set

public void set(String name,
                String value,
                String charset)
Set a parameter. If this parameter already exists, it is replaced by this new value. If the mail.mime.encodeparameters System property is true, and the parameter value is non-ASCII, it will be encoded with the specified charset, as specified by RFC 2231.

参数:
name - name of the parameter.
value - value of the parameter.
charset - charset of the parameter value.
从以下版本开始:
JavaMail 1.4

remove

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

参数:
name - name of the parameter.

getNames

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

返回:
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.

重写:
toString in class Object
返回:
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.

参数:
used - number of character positions already used, in the field into which the parameter list is to be inserted.
返回:
String

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.