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

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

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

Message.getSize介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

break;
case MailInputField.COLUMN_SIZE:
 r[index] = new Long( message.getSize() );
 break;
case MailInputField.COLUMN_FLAG_DRAFT:

代码示例来源:origin: pentaho/pentaho-kettle

when( message.getSentDate() ).thenReturn( DATE2 );
when( message.getContentType() ).thenReturn( CNTNT_TYPE_EMAIL );
when( message.getSize() ).thenReturn( CNTNT_SIZE );

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

/**
 * The match method.
 *
 * @param msg    the size comparator is applied to this Message's size
 * @return        true if the size is equal, otherwise false 
 */
public boolean match(Message msg) {
int size;
try {
  size = msg.getSize();
} catch (Exception e) {
  return false;
}
if (size == -1)
  return false;
return super.match(size);
}

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

/**
 * The match method.
 *
 * @param msg    the size comparator is applied to this Message's size
 * @return        true if the size is equal, otherwise false 
 */
@Override
public boolean match(Message msg) {
int size;
try {
  size = msg.getSize();
} catch (Exception e) {
  return false;
}
if (size == -1)
  return false;
return super.match(size);
}

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

/**
 * Converts an email message to a raw string.  This raw string
 * is passed to the error manager to allow custom error managers
 * to recreate the original MimeMessage object.
 * @param msg a Message object.
 * @return the raw string or null if msg was null.
 * @throws MessagingException if there was a problem with the message.
 * @throws IOException if there was a problem.
 */
private String toRawString(final Message msg) throws MessagingException, IOException {
  if (msg != null) {
    Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER);
    try {  //BUGID 8025251
      int nbytes = Math.max(msg.getSize() + MIN_HEADER_SIZE, MIN_HEADER_SIZE);
      ByteArrayOutputStream out = new ByteArrayOutputStream(nbytes);
      msg.writeTo(out);
      return out.toString("US-ASCII"); //Raw message is always ASCII.
    } finally {
      getAndSetContextClassLoader(ccl);
    }
  } else { //Must match this.reportError behavior, see push method.
    return null; //Null is the safe choice.
  }
}

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

/**
 * Converts an email message to a raw string.  This raw string
 * is passed to the error manager to allow custom error managers
 * to recreate the original MimeMessage object.
 * @param msg a Message object.
 * @return the raw string or null if msg was null.
 * @throws MessagingException if there was a problem with the message.
 * @throws IOException if there was a problem.
 */
private String toRawString(final Message msg) throws MessagingException, IOException {
  if (msg != null) {
    Object ccl = getAndSetContextClassLoader(MAILHANDLER_LOADER);
    try {  //JDK-8025251
      int nbytes = Math.max(msg.getSize() + MIN_HEADER_SIZE, MIN_HEADER_SIZE);
      ByteArrayOutputStream out = new ByteArrayOutputStream(nbytes);
      msg.writeTo(out);  //Headers can be UTF-8 or US-ASCII.
      return out.toString("UTF-8");
    } finally {
      getAndSetContextClassLoader(ccl);
    }
  } else { //Must match this.reportError behavior, see push method.
    return null; //Null is the safe choice.
  }
}

代码示例来源:origin: stackoverflow.com

final void messageSent(final ConnectionContext context, final Message msg) throws Exception {
 destinationStatistics.getEnqueues().increment();
 destinationStatistics.getMessages().increment();
 destinationStatistics.getMessageSize().addSize(msg.getSize());

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

m.getSize() > maxsize ? 0 : maxsize);
} catch (IOException ex) {
throw new MessagingException(

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

m.getSize() > maxsize ? 0 : maxsize);
} catch (IOException ex) {
throw new MessagingException(

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

m.getSize() > maxsize ? 0 : maxsize);
} catch (IOException ex) {
throw new MessagingException(

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

m.getSize() > maxsize ? 0 : maxsize);
} catch (IOException ex) {
throw new MessagingException(

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

public boolean match(Message message) {
  try {
    return match(message.getSize());
  } catch (MessagingException e) {
    return false;
  }
}

代码示例来源:origin: google/mail-importer

@Override
public int getSize() throws RuntimeMessagingException {
 try {
  return delegate.getSize();
 } catch (MessagingException e) {
  throw new RuntimeMessagingException(e);
 }
}

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

public boolean match(Message message) {
    try {
      return match(message.getSize());
    } catch (MessagingException e) {
      return false;
    }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

/**
 * The match method.
 *
 * @param msg    the size comparator is applied to this Message's size
 * @return        true if the size is equal, otherwise false 
 */
public boolean match(Message msg) {
int size;
try {
  size = msg.getSize();
} catch (Exception e) {
  return false;
}
if (size == -1)
  return false;
return super.match(size);
}

代码示例来源:origin: org.apache.james/apache-jsieve-util

/**
 * Method getSize answers the receiver's message size in octets.
 *
 * @return int
 * @throws SieveMailException
 */
public int getSize() throws SieveMailException {
  int result = 0;
  if (mail != null) {
    try {
      result = mail.getSize();
    } catch (MessagingException e) {
      throw new SieveMailException(e);
    }
  }
  return result;
}

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

/**
 * The match method.
 *
 * @param msg    the size comparator is applied to this Message's size
 * @return        true if the size is equal, otherwise false 
 */
@Override
public boolean match(Message msg) {
int size;
try {
  size = msg.getSize();
} catch (Exception e) {
  return false;
}
if (size == -1)
  return false;
return super.match(size);
}

代码示例来源:origin: de.saly/javamail-mock2-fullmock

@Override
public synchronized int[] getSizes() throws MessagingException {
  checkOpened();
  final int count = getMessageCount();
  final int[] sizes = new int[count];
  for (int i = 1; i <= count; i++) {
    sizes[i - 1] = getMessage(i).getSize();
  }
  return sizes;
}

代码示例来源:origin: salyh/javamail-mock2

@Override
public synchronized int[] getSizes() throws MessagingException {
  checkOpened();
  final int count = getMessageCount();
  final int[] sizes = new int[count];
  for (int i = 1; i <= count; i++) {
    sizes[i - 1] = getMessage(i).getSize();
  }
  return sizes;
}

代码示例来源:origin: de.saly/javamail-mock2-halfmock

@Override
public synchronized int[] getSizes() throws MessagingException {
  checkOpened();
  final int count = getMessageCount();
  final int[] sizes = new int[count];
  for (int i = 1; i <= count; i++) {
    sizes[i - 1] = getMessage(i).getSize();
  }
  return sizes;
}

相关文章

微信公众号

最新文章

更多