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

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

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

MimeBodyPart.getSize介绍

[英]Return the size of the content of this body part in bytes. Return -1 if the size cannot be determined.

Note that this number may not be an exact measure of the content size and may or may not account for any transfer encoding of the content.

This implementation returns the size of the content array (if not null), or, if contentStream is not null, and the available method returns a positive number, it returns that number as the size. Otherwise, it returns -1.
[中]返回此正文部分内容的大小(字节)。如果无法确定大小,则返回-1。
请注意,这个数字可能不是内容大小的精确测量值,也可能不是内容传输编码的原因。
这个实现返回content数组的大小(如果不是null),或者,如果contentStream不是null,并且available方法返回一个正数,它将该数字作为大小返回。否则,返回-1。

代码示例

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

int mbpSize = mbp.getSize();
if ( (attachmentRunningTotal + mbpSize) < maxAttachmentSize )

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

dataSize = bp.getSize();

代码示例来源:origin: axis/axis

dataSize = bp.getSize();

代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis

dataSize = bp.getSize();

代码示例来源:origin: org.apache.axis2.transport/axis2-transport-mail

private void updateMetrics(Message message) throws IOException, MessagingException {
  if (message instanceof MimeMessage) {
    MimeMessage mimeMessage = (MimeMessage) message;
    if (mimeMessage.getContent() instanceof Multipart) {
      Multipart mp = (Multipart) mimeMessage.getContent();
      for (int i=0; i<mp.getCount(); i++) {
        MimeBodyPart mbp = (MimeBodyPart) mp.getBodyPart(i);
        int size = mbp.getSize();
        if (size != -1) {
          metrics.incrementBytesReceived(size);
        }
      }
    } else {
      int size = mimeMessage.getSize();
      if (size != -1) {
        metrics.incrementBytesReceived(size);
      }
    }
  }
}

代码示例来源:origin: org.apache.axis2/axis2-transport-mail

private void updateMetrics(Message message) throws IOException, MessagingException {
  if (message instanceof MimeMessage) {
    MimeMessage mimeMessage = (MimeMessage) message;
    if (mimeMessage.getContent() instanceof Multipart) {
      Multipart mp = (Multipart) mimeMessage.getContent();
      for (int i=0; i<mp.getCount(); i++) {
        MimeBodyPart mbp = (MimeBodyPart) mp.getBodyPart(i);
        int size = mbp.getSize();
        if (size != -1) {
          metrics.incrementBytesReceived(size);
        }
      }
    } else {
      int size = mimeMessage.getSize();
      if (size != -1) {
        metrics.incrementBytesReceived(size);
      }
    }
  }
}

代码示例来源:origin: apache/axis2-java

private void updateMetrics(Message message) throws IOException, MessagingException {
  if (message instanceof MimeMessage) {
    MimeMessage mimeMessage = (MimeMessage) message;
    if (mimeMessage.getContent() instanceof Multipart) {
      Multipart mp = (Multipart) mimeMessage.getContent();
      for (int i=0; i<mp.getCount(); i++) {
        MimeBodyPart mbp = (MimeBodyPart) mp.getBodyPart(i);
        int size = mbp.getSize();
        if (size != -1) {
          metrics.incrementBytesReceived(size);
        }
      }
    } else {
      int size = mimeMessage.getSize();
      if (size != -1) {
        metrics.incrementBytesReceived(size);
      }
    }
  }
}

代码示例来源:origin: com.helger/ph-as4-lib

if (canBeKeptInMemory (aBodyPart.getSize ()))

相关文章