本文整理汇总了Java中javax.mail.internet.ParameterList类的典型用法代码示例。如果您正苦于以下问题:Java ParameterList类的具体用法?Java ParameterList怎么用?Java ParameterList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterList类属于javax.mail.internet包,在下文中一共展示了ParameterList类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateContentType
import javax.mail.internet.ParameterList; //导入依赖的package包/类
private void updateContentType(boolean cleanDefaultRoot) throws MessagingException {
BodyPart part = null;
if (rootId == null) {
part = getBodyPart(0);
} else {
part = getBodyPart(rootId);
if (part == null) {
if (cleanDefaultRoot)
rootId = null;
else
throw new MessagingException("Can not set root: " + rootId + ": not found");
}
}
if (part != null) {
String primaryType = baseContentTypeObject.getPrimaryType();
String subType = baseContentTypeObject.getSubType();
ParameterList params = baseContentTypeObject.getParameterList();
ContentType newContentType = new ContentType(primaryType, subType, params);
ContentType rootContentType = new ContentType(part.getDataHandler().getContentType());
newContentType.setParameter("type", rootContentType.getBaseType());
if (rootId != null)
newContentType.setParameter("start", stripBrackets(rootId));
contentType = newContentType.toString();
}
}
示例2: addCharset
import javax.mail.internet.ParameterList; //导入依赖的package包/类
public static ContentType addCharset(ContentType contentType, String charset) {
ParameterList orgParamList = contentType.getParameterList();
ParameterList paramList = new ParameterList();
if (orgParamList != null) {
for (Enumeration<?> e = orgParamList.getNames(); e.hasMoreElements(); ) {
String name = (String)e.nextElement();
paramList.set(name, orgParamList.get(name));
}
}
paramList.set("charset", charset);
return new ContentType(contentType.getPrimaryType(), contentType.getSubType(), paramList);
}
示例3: removeCharset
import javax.mail.internet.ParameterList; //导入依赖的package包/类
public static ContentType removeCharset(ContentType contentType) {
ParameterList orgParamList = contentType.getParameterList();
ParameterList paramList = new ParameterList();
for (Enumeration<?> e = orgParamList.getNames(); e.hasMoreElements(); ) {
String name = (String)e.nextElement();
if (!name.equalsIgnoreCase("charset")) {
paramList.set(name, orgParamList.get(name));
}
}
return new ContentType(contentType.getPrimaryType(), contentType.getSubType(), paramList);
}