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

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

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

MimeMultipart.getPreamble介绍

[英]Get the preamble text, if any, that appears before the first body part of this multipart. Some protocols, such as IMAP, will not allow access to the preamble text.
[中]获取出现在此多部分的第一个正文部分之前的序言文本(如果有)。某些协议(如IMAP)不允许访问序言文本。

代码示例

代码示例来源:origin: org.wso2.org.apache.commons/commons-vfs2-sandbox

/**
 * Creates an input stream to read the file content from.
 */
@Override
protected InputStream doGetInputStream() throws Exception {
  if (isMultipart()) {
    // deliver the preamble as the only content
    final String preamble = ((MimeMultipart) part.getContent()).getPreamble();
    if (preamble == null) {
      return new ByteArrayInputStream(new byte[] {});
    }
    return new ByteArrayInputStream(preamble.getBytes(MimeFileSystem.PREAMBLE_CHARSET));
  }
  return part.getInputStream();
}

代码示例来源:origin: org.apache.commons/commons-vfs2-sandbox

/**
 * Creates an input stream to read the file content from.
 */
@Override
protected InputStream doGetInputStream() throws Exception
{
  if (isMultipart())
  {
    // deliver the preamble as the only content
    String preamble = ((MimeMultipart) part.getContent()).getPreamble();
    if (preamble == null)
    {
      return new ByteArrayInputStream(new byte[]{});
    }
    return new ByteArrayInputStream(preamble.getBytes(MimeFileSystem.PREAMBLE_CHARSET));
  }
  return part.getInputStream();
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_mail

private void appendMultiPart(SampleResult child, StringBuilder cdata,
    MimeMultipart mmp) throws MessagingException, IOException {
  String preamble = mmp.getPreamble();
  if (preamble != null ){
    cdata.append(preamble);

相关文章