public class ParameterList extends Object
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
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.
The current implementation supports the System property
mail.mime.parameters.strict
, which if set to false
when parsing a parameter list allows parameter values
to contain whitespace and other special characters without
being quoted; the parameter value ends at the next semicolon.
If set to true (the default), parameter values are required to conform
to the MIME specification and must be quoted if they contain whitespace
or special characters.
Constructor and Description |
---|
ParameterList()
No-arg Constructor.
|
ParameterList(String s)
Constructor that takes a parameter-list string.
|
Modifier and Type | Method and Description |
---|---|
void |
combineSegments()
Normal users of this class will use simple parameter names.
|
String |
get(String name)
Returns the value of the specified parameter.
|
Enumeration<String> |
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.
|
public ParameterList()
public ParameterList(String s) throws ParseException
s
- the parameter-list string.ParseException
- if the parse fails.public void combineSegments()
set(java.lang.String, java.lang.String)
method. After all these segments are added
to this ParameterList, they need to be combined to represent
the logical parameter name and value. This method will combine
all segments of multi-segment names. Normal users should never need to call this method.
public int size()
public String get(String name)
name
- parameter name.null
if the parameter is not
present.public void set(String name, String value)
name
- name of the parameter.value
- value of the parameter.public void set(String name, String value, String charset)
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.public void remove(String name)
name
- name of the parameter.public Enumeration<String> getNames()
public String toString()
public String toString(int used)
used
- number of character positions already used, in
the field into which the parameter list is to
be inserted.Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.