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

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

本文整理了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

  1. /**
  2. * Set the "Content-Description" header field for this body part.
  3. * If the description parameter is <code>null</code>, then any
  4. * existing "Content-Description" fields are removed. <p>
  5. *
  6. * If the description contains non US-ASCII characters, it will
  7. * be encoded using the platform's default charset. If the
  8. * description contains only US-ASCII characters, no encoding
  9. * is done and it is used as is. <p>
  10. *
  11. * Note that if the charset encoding process fails, a
  12. * MessagingException is thrown, and an UnsupportedEncodingException
  13. * is included in the chain of nested exceptions within the
  14. * MessagingException.
  15. *
  16. * @param description content description
  17. * @exception IllegalWriteException if the underlying
  18. * implementation does not support modification
  19. * @exception IllegalStateException if this body part is
  20. * obtained from a READ_ONLY folder.
  21. * @exception MessagingException otherwise; an
  22. * UnsupportedEncodingException may be included
  23. * in the exception chain if the charset
  24. * conversion fails.
  25. */
  26. public void setDescription(String description) throws MessagingException {
  27. setDescription(description, null);
  28. }

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

  1. /**
  2. * Set the "Content-Description" header field for this Message.
  3. * If the description parameter is <code>null</code>, then any
  4. * existing "Content-Description" fields are removed. <p>
  5. *
  6. * If the description contains non US-ASCII characters, it will
  7. * be encoded using the specified charset. If the description
  8. * contains only US-ASCII characters, no encoding is done and
  9. * it is used as-is. <p>
  10. *
  11. * Note that if the charset encoding process fails, a
  12. * MessagingException is thrown, and an UnsupportedEncodingException
  13. * is included in the chain of nested exceptions within the
  14. * MessagingException.
  15. *
  16. * @param description Description
  17. * @param charset Charset for encoding
  18. * @exception IllegalWriteException if the underlying
  19. * implementation does not support modification
  20. * @exception IllegalStateException if this message is
  21. * obtained from a READ_ONLY folder.
  22. * @exception MessagingException An
  23. * UnsupportedEncodingException may be included
  24. * in the exception chain if the charset
  25. * conversion fails.
  26. */
  27. public void setDescription(String description, String charset)
  28. throws MessagingException {
  29. MimeBodyPart.setDescription(this, description, charset);
  30. }

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

  1. /**
  2. * Set the "Content-Description" header field for this body part.
  3. * If the description parameter is <code>null</code>, then any
  4. * existing "Content-Description" fields are removed. <p>
  5. *
  6. * If the description contains non US-ASCII characters, it will
  7. * be encoded using the specified charset. If the description
  8. * contains only US-ASCII characters, no encoding is done and
  9. * it is used as is. <p>
  10. *
  11. * Note that if the charset encoding process fails, a
  12. * MessagingException is thrown, and an UnsupportedEncodingException
  13. * is included in the chain of nested exceptions within the
  14. * MessagingException.
  15. *
  16. * @param description Description
  17. * @param charset Charset for encoding
  18. * @exception IllegalWriteException if the underlying
  19. * implementation does not support modification
  20. * @exception IllegalStateException if this body part is
  21. * obtained from a READ_ONLY folder.
  22. * @exception MessagingException otherwise; an
  23. * UnsupportedEncodingException may be included
  24. * in the exception chain if the charset
  25. * conversion fails.
  26. */
  27. public void setDescription(String description, String charset)
  28. throws MessagingException {
  29. setDescription(this, description, charset);
  30. }

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

  1. /**
  2. * Set the "Content-Description" header field for this body part.
  3. * If the description parameter is <code>null</code>, then any
  4. * existing "Content-Description" fields are removed. <p>
  5. *
  6. * If the description contains non US-ASCII characters, it will
  7. * be encoded using the platform's default charset. If the
  8. * description contains only US-ASCII characters, no encoding
  9. * is done and it is used as is. <p>
  10. *
  11. * Note that if the charset encoding process fails, a
  12. * MessagingException is thrown, and an UnsupportedEncodingException
  13. * is included in the chain of nested exceptions within the
  14. * MessagingException.
  15. *
  16. * @param description content description
  17. * @exception IllegalWriteException if the underlying
  18. * implementation does not support modification
  19. * @exception IllegalStateException if this body part is
  20. * obtained from a READ_ONLY folder.
  21. * @exception MessagingException otherwise; an
  22. * UnsupportedEncodingException may be included
  23. * in the exception chain if the charset
  24. * conversion fails.
  25. */
  26. @Override
  27. public void setDescription(String description) throws MessagingException {
  28. setDescription(description, null);
  29. }

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

  1. /**
  2. * Set the "Content-Description" header field for this body part.
  3. * If the description parameter is <code>null</code>, then any
  4. * existing "Content-Description" fields are removed. <p>
  5. *
  6. * If the description contains non US-ASCII characters, it will
  7. * be encoded using the specified charset. If the description
  8. * contains only US-ASCII characters, no encoding is done and
  9. * it is used as is. <p>
  10. *
  11. * Note that if the charset encoding process fails, a
  12. * MessagingException is thrown, and an UnsupportedEncodingException
  13. * is included in the chain of nested exceptions within the
  14. * MessagingException.
  15. *
  16. * @param description Description
  17. * @param charset Charset for encoding
  18. * @exception IllegalWriteException if the underlying
  19. * implementation does not support modification
  20. * @exception IllegalStateException if this body part is
  21. * obtained from a READ_ONLY folder.
  22. * @exception MessagingException otherwise; an
  23. * UnsupportedEncodingException may be included
  24. * in the exception chain if the charset
  25. * conversion fails.
  26. */
  27. public void setDescription(String description, String charset)
  28. throws MessagingException {
  29. setDescription(this, description, charset);
  30. }

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

  1. /**
  2. * Set the "Content-Description" header field for this Message.
  3. * If the description parameter is <code>null</code>, then any
  4. * existing "Content-Description" fields are removed. <p>
  5. *
  6. * If the description contains non US-ASCII characters, it will
  7. * be encoded using the specified charset. If the description
  8. * contains only US-ASCII characters, no encoding is done and
  9. * it is used as-is. <p>
  10. *
  11. * Note that if the charset encoding process fails, a
  12. * MessagingException is thrown, and an UnsupportedEncodingException
  13. * is included in the chain of nested exceptions within the
  14. * MessagingException.
  15. *
  16. * @param description Description
  17. * @param charset Charset for encoding
  18. * @exception IllegalWriteException if the underlying
  19. * implementation does not support modification
  20. * @exception IllegalStateException if this message is
  21. * obtained from a READ_ONLY folder.
  22. * @exception MessagingException An
  23. * UnsupportedEncodingException may be included
  24. * in the exception chain if the charset
  25. * conversion fails.
  26. */
  27. public void setDescription(String description, String charset)
  28. throws MessagingException {
  29. MimeBodyPart.setDescription(this, description, charset);
  30. }

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

  1. /**
  2. * Factory to create the attachment body part.
  3. * @param index the attachment index.
  4. * @return a body part with default headers set.
  5. * @throws MessagingException if there is a problem.
  6. * @throws IndexOutOfBoundsException if the given index is not an valid
  7. * attachment index.
  8. */
  9. private MimeBodyPart createBodyPart(int index) throws MessagingException {
  10. assert Thread.holdsLock(this);
  11. final MimeBodyPart part = new MimeBodyPart();
  12. part.setDisposition(Part.ATTACHMENT);
  13. part.setDescription(descriptionFrom(
  14. attachmentFormatters[index],
  15. attachmentFilters[index],
  16. attachmentNames[index]));
  17. setAcceptLang(part);
  18. return part;
  19. }

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

  1. /**
  2. * Factory to create the attachment body part.
  3. * @param index the attachment index.
  4. * @return a body part with default headers set.
  5. * @throws MessagingException if there is a problem.
  6. * @throws IndexOutOfBoundsException if the given index is not an valid
  7. * attachment index.
  8. */
  9. private MimeBodyPart createBodyPart(int index) throws MessagingException {
  10. assert Thread.holdsLock(this);
  11. final MimeBodyPart part = new MimeBodyPart();
  12. part.setDisposition(Part.ATTACHMENT);
  13. part.setDescription(descriptionFrom(
  14. attachmentFormatters[index],
  15. attachmentFilters[index],
  16. attachmentNames[index]));
  17. setAcceptLang(part);
  18. return part;
  19. }

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

  1. /**
  2. * Factory to create the in-line body part.
  3. * @return a body part with default headers set.
  4. * @throws MessagingException if there is a problem.
  5. */
  6. private MimeBodyPart createBodyPart() throws MessagingException {
  7. assert Thread.holdsLock(this);
  8. final MimeBodyPart part = new MimeBodyPart();
  9. part.setDisposition(Part.INLINE);
  10. part.setDescription(descriptionFrom(getFormatter(),
  11. getFilter(), subjectFormatter));
  12. setAcceptLang(part);
  13. return part;
  14. }

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

  1. /**
  2. * Factory to create the in-line body part.
  3. * @return a body part with default headers set.
  4. * @throws MessagingException if there is a problem.
  5. */
  6. private MimeBodyPart createBodyPart() throws MessagingException {
  7. assert Thread.holdsLock(this);
  8. final MimeBodyPart part = new MimeBodyPart();
  9. part.setDisposition(Part.INLINE);
  10. part.setDescription(descriptionFrom(getFormatter(),
  11. getFilter(), subjectFormatter));
  12. setAcceptLang(part);
  13. return part;
  14. }

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

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

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

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

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

  1. public void setDescription(String description) throws MessagingException {
  2. setDescription(description, null);
  3. }

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

  1. public void setDescription(String description) throws MessagingException {
  2. setDescription(description, null);
  3. }

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

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

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

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

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

  1. private MimeBodyPart createBodyPart(int index) throws MessagingException {
  2. assert Thread.holdsLock(this);
  3. final MimeBodyPart part = new MimeBodyPart();
  4. part.setDisposition(Part.ATTACHMENT);
  5. part.setDescription(descriptionFrom(
  6. attachmentFormatters[index],
  7. attachmentFilters[index],
  8. attachmentNames[index]));
  9. setAcceptLang(part);
  10. return part;
  11. }

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

  1. public static void
  2. IMAPMimeBodyPart_setDescription(MimeBodyPart mbp, String description)
  3. throws MessagingException
  4. {
  5. if (!Profiler.INSTANCE.isActive()) // only needed for better performance
  6. mbp.setDescription(description);
  7. else
  8. profileInvokeMExcep(mbp, "setDescription", description);
  9. }

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

  1. private MimeBodyPart createBodyPart() throws MessagingException {
  2. assert Thread.holdsLock(this);
  3. final MimeBodyPart part = new MimeBodyPart();
  4. part.setDisposition(Part.INLINE);
  5. part.setDescription(descriptionFrom(getFormatter(),
  6. getFilter(), subjectFormatter));
  7. setAcceptLang(part);
  8. return part;
  9. }

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

  1. /**
  2. * Factory to create the in-line body part.
  3. * @return a body part with default headers set.
  4. * @throws MessagingException if there is a problem.
  5. */
  6. private MimeBodyPart createBodyPart() throws MessagingException {
  7. assert Thread.holdsLock(this);
  8. final MimeBodyPart part = new MimeBodyPart();
  9. part.setDisposition(Part.INLINE);
  10. part.setDescription(descriptionFrom(getFormatter(),
  11. getFilter(), subjectFormatter));
  12. setAcceptLang(part);
  13. return part;
  14. }

相关文章