javax.mail.internet.MimeBodyPart.setDescription()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(12.1k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中javax.mail.internet.MimeBodyPart.setDescription()方法的一些代码示例,展示了MimeBodyPart.setDescription()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeBodyPart.setDescription()方法的具体详情如下:
包路径:javax.mail.internet.MimeBodyPart
类名称:MimeBodyPart
方法名:setDescription

MimeBodyPart.setDescription介绍

[英]Set the "Content-Description" header field for this body part. If the description parameter is null, then any existing "Content-Description" fields are removed.

If the description contains non US-ASCII characters, it will be encoded using the platform's default charset. If the description contains only US-ASCII characters, no encoding is done and it is used as is.

Note that if the charset encoding process fails, a MessagingException is thrown, and an UnsupportedEncodingException is included in the chain of nested exceptions within the MessagingException.
[中]设置此身体部位的“内容描述”标题字段。如果描述参数为null,则删除所有现有的“内容描述”字段。
如果描述包含非US-ASCII字符,则将使用平台的默认字符集对其进行编码。如果描述仅包含US-ASCII字符,则不进行编码,而是按原样使用。
请注意,如果字符集编码过程失败,将抛出MessaginException,并且在MessaginException内的嵌套异常链中包含UnsupportedEncodingException。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the "Content-Description" header field for this body part.
 * If the description parameter is <code>null</code>, then any 
 * existing "Content-Description" fields are removed. <p>
 *
 * If the description contains non US-ASCII characters, it will 
 * be encoded using the platform's default charset. If the 
 * description contains only US-ASCII characters, no encoding 
 * is done and it is used as is. <p>
 *
 * Note that if the charset encoding process fails, a
 * MessagingException is thrown, and an UnsupportedEncodingException
 * is included in the chain of nested exceptions within the
 * MessagingException.
 * 
 * @param description content description
 * @exception    IllegalWriteException if the underlying
 *            implementation does not support modification
 * @exception    IllegalStateException if this body part is
 *            obtained from a READ_ONLY folder.
 * @exception       MessagingException otherwise; an
 *                  UnsupportedEncodingException may be included
 *                  in the exception chain if the charset
 *                  conversion fails.
 */
public void setDescription(String description) throws MessagingException {
setDescription(description, null);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the "Content-Description" header field for this Message.
 * If the description parameter is <code>null</code>, then any 
 * existing "Content-Description" fields are removed. <p>
 *
 * If the description contains non US-ASCII characters, it will 
 * be encoded using the specified charset. If the description 
 * contains only US-ASCII characters, no encoding  is done and 
 * it is used as-is. <p>
 *
 * Note that if the charset encoding process fails, a
 * MessagingException is thrown, and an UnsupportedEncodingException
 * is included in the chain of nested exceptions within the
 * MessagingException.
 * 
 * @param    description    Description
 * @param    charset        Charset for encoding
 * @exception        IllegalWriteException if the underlying
 *                implementation does not support modification
 * @exception        IllegalStateException if this message is
 *                obtained from a READ_ONLY folder.
 * @exception        MessagingException An
 *                 UnsupportedEncodingException may be included
 *                in the exception chain if the charset
 *                conversion fails.
 */
public void setDescription(String description, String charset) 
  throws MessagingException {
MimeBodyPart.setDescription(this, description, charset);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Set the "Content-Description" header field for this body part.
 * If the description parameter is <code>null</code>, then any 
 * existing "Content-Description" fields are removed. <p>
 *
 * If the description contains non US-ASCII characters, it will 
 * be encoded using the specified charset. If the description 
 * contains only US-ASCII characters, no encoding  is done and 
 * it is used as is. <p>
 *
 * Note that if the charset encoding process fails, a
 * MessagingException is thrown, and an UnsupportedEncodingException
 * is included in the chain of nested exceptions within the
 * MessagingException.
 *
 * @param    description    Description
 * @param    charset        Charset for encoding
 * @exception    IllegalWriteException if the underlying
 *            implementation does not support modification
 * @exception    IllegalStateException if this body part is
 *            obtained from a READ_ONLY folder.
 * @exception       MessagingException otherwise; an
 *                  UnsupportedEncodingException may be included
 *                  in the exception chain if the charset
 *                  conversion fails.
 */
public void setDescription(String description, String charset) 
  throws MessagingException {
setDescription(this, description, charset);
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Set the "Content-Description" header field for this body part.
 * If the description parameter is <code>null</code>, then any 
 * existing "Content-Description" fields are removed. <p>
 *
 * If the description contains non US-ASCII characters, it will 
 * be encoded using the platform's default charset. If the 
 * description contains only US-ASCII characters, no encoding 
 * is done and it is used as is. <p>
 *
 * Note that if the charset encoding process fails, a
 * MessagingException is thrown, and an UnsupportedEncodingException
 * is included in the chain of nested exceptions within the
 * MessagingException.
 * 
 * @param description content description
 * @exception    IllegalWriteException if the underlying
 *            implementation does not support modification
 * @exception    IllegalStateException if this body part is
 *            obtained from a READ_ONLY folder.
 * @exception       MessagingException otherwise; an
 *                  UnsupportedEncodingException may be included
 *                  in the exception chain if the charset
 *                  conversion fails.
 */
@Override
public void setDescription(String description) throws MessagingException {
setDescription(description, null);
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Set the "Content-Description" header field for this body part.
 * If the description parameter is <code>null</code>, then any 
 * existing "Content-Description" fields are removed. <p>
 *
 * If the description contains non US-ASCII characters, it will 
 * be encoded using the specified charset. If the description 
 * contains only US-ASCII characters, no encoding  is done and 
 * it is used as is. <p>
 *
 * Note that if the charset encoding process fails, a
 * MessagingException is thrown, and an UnsupportedEncodingException
 * is included in the chain of nested exceptions within the
 * MessagingException.
 *
 * @param    description    Description
 * @param    charset        Charset for encoding
 * @exception    IllegalWriteException if the underlying
 *            implementation does not support modification
 * @exception    IllegalStateException if this body part is
 *            obtained from a READ_ONLY folder.
 * @exception       MessagingException otherwise; an
 *                  UnsupportedEncodingException may be included
 *                  in the exception chain if the charset
 *                  conversion fails.
 */
public void setDescription(String description, String charset) 
  throws MessagingException {
setDescription(this, description, charset);
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Set the "Content-Description" header field for this Message.
 * If the description parameter is <code>null</code>, then any 
 * existing "Content-Description" fields are removed. <p>
 *
 * If the description contains non US-ASCII characters, it will 
 * be encoded using the specified charset. If the description 
 * contains only US-ASCII characters, no encoding  is done and 
 * it is used as-is. <p>
 *
 * Note that if the charset encoding process fails, a
 * MessagingException is thrown, and an UnsupportedEncodingException
 * is included in the chain of nested exceptions within the
 * MessagingException.
 * 
 * @param    description    Description
 * @param    charset        Charset for encoding
 * @exception        IllegalWriteException if the underlying
 *                implementation does not support modification
 * @exception        IllegalStateException if this message is
 *                obtained from a READ_ONLY folder.
 * @exception        MessagingException An
 *                 UnsupportedEncodingException may be included
 *                in the exception chain if the charset
 *                conversion fails.
 */
public void setDescription(String description, String charset) 
  throws MessagingException {
MimeBodyPart.setDescription(this, description, charset);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Factory to create the attachment body part.
 * @param index the attachment index.
 * @return a body part with default headers set.
 * @throws MessagingException if there is a problem.
 * @throws IndexOutOfBoundsException if the given index is not an valid
 * attachment index.
 */
private MimeBodyPart createBodyPart(int index) throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.ATTACHMENT);
  part.setDescription(descriptionFrom(
      attachmentFormatters[index],
      attachmentFilters[index],
      attachmentNames[index]));
  setAcceptLang(part);
  return part;
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Factory to create the attachment body part.
 * @param index the attachment index.
 * @return a body part with default headers set.
 * @throws MessagingException if there is a problem.
 * @throws IndexOutOfBoundsException if the given index is not an valid
 * attachment index.
 */
private MimeBodyPart createBodyPart(int index) throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.ATTACHMENT);
  part.setDescription(descriptionFrom(
      attachmentFormatters[index],
      attachmentFilters[index],
      attachmentNames[index]));
  setAcceptLang(part);
  return part;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Factory to create the in-line body part.
 * @return a body part with default headers set.
 * @throws MessagingException if there is a problem.
 */
private MimeBodyPart createBodyPart() throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.INLINE);
  part.setDescription(descriptionFrom(getFormatter(),
      getFilter(), subjectFormatter));
  setAcceptLang(part);
  return part;
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Factory to create the in-line body part.
 * @return a body part with default headers set.
 * @throws MessagingException if there is a problem.
 */
private MimeBodyPart createBodyPart() throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.INLINE);
  part.setDescription(descriptionFrom(getFormatter(),
      getFilter(), subjectFormatter));
  setAcceptLang(part);
  return part;
}

代码示例来源:origin: com.sun.mail/javax.mail

body.setDescription("Formatted using "
    + (t == null ? Throwable.class.getName()
        : t.getClass().getName()) + ", filtered with "

代码示例来源:origin: camunda/camunda-bpm-platform

body.setDescription("Formatted using "
    + (t == null ? Throwable.class.getName()
        : t.getClass().getName()) + ", filtered with "

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

public void setDescription(String description) throws MessagingException {
  setDescription(description, null);
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

public void setDescription(String description) throws MessagingException {
  setDescription(description, null);
}

代码示例来源:origin: com.sun.mail/javax.mail

body.setDescription(verify);
setContent(body, "", bodyContentType);
multipart.addBodyPart(body);
for (int i = 0; i < ambp.length; ++i) {
  ambp[i].setDescription(verify);
  setContent(ambp[i], "", atn[i]);

代码示例来源:origin: camunda/camunda-bpm-platform

body.setDescription(verify);
setContent(body, "", bodyContentType);
multipart.addBodyPart(body);
for (int i = 0; i < ambp.length; ++i) {
  ambp[i].setDescription(verify);
  setContent(ambp[i], "", atn[i]);

代码示例来源:origin: javax.mail/com.springsource.javax.mail

private MimeBodyPart createBodyPart(int index) throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.ATTACHMENT);
  part.setDescription(descriptionFrom(
      attachmentFormatters[index],
      attachmentFilters[index],
      attachmentNames[index]));
  setAcceptLang(part);
  return part;
}

代码示例来源:origin: org.evolvis.bsi/kolab-ws

public static void
IMAPMimeBodyPart_setDescription(MimeBodyPart mbp, String description)
throws MessagingException
{
  if (!Profiler.INSTANCE.isActive()) // only needed for better performance
    mbp.setDescription(description);
  else
    profileInvokeMExcep(mbp, "setDescription", description);
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

private MimeBodyPart createBodyPart() throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.INLINE);
  part.setDescription(descriptionFrom(getFormatter(),
      getFilter(), subjectFormatter));
  setAcceptLang(part);
  return part;
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Factory to create the in-line body part.
 * @return a body part with default headers set.
 * @throws MessagingException if there is a problem.
 */
private MimeBodyPart createBodyPart() throws MessagingException {
  assert Thread.holdsLock(this);
  final MimeBodyPart part = new MimeBodyPart();
  part.setDisposition(Part.INLINE);
  part.setDescription(descriptionFrom(getFormatter(),
      getFilter(), subjectFormatter));
  setAcceptLang(part);
  return part;
}

相关文章