/**
* Sets the attachment <tt>Formatter</tt> object for this handler.
* The number of formatters determines the number of attachments per
* email. This method should be the first attachment method called.
* To remove all attachments, call this method with empty array.
* @param formatters a non null array of formatters.
* @throws SecurityException if a security manager exists and the
* caller does not have <tt>LoggingPermission("control")</tt>.
* @throws NullPointerException if the given array or any array index is
* <tt>null</tt>.
* @throws IllegalStateException if called from inside a push.
*/
public final void setAttachmentFormatters(Formatter... formatters) {
checkAccess();
if (formatters.length == 0) { //Null check and length check.
formatters = emptyFormatterArray();
} else {
formatters = copyOf(formatters,
formatters.length, Formatter[].class);
for (int i = 0; i < formatters.length; ++i) {
if (formatters[i] == null) {
throw new NullPointerException(atIndexMsg(i));
}
}
}
synchronized (this) {
if (isWriting) {
throw new IllegalStateException();
}
this.attachmentFormatters = formatters;
this.fixUpAttachmentFilters();
this.fixUpAttachmentNames();
}
}
MailHandler.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:kore-javamail
作者:
评论列表
文章目录