/** * @return the message size * @throws MessagingException */ public long getMessageSize() throws MessagingException { return MimeMessageUtil.getMessageSize(getWrappedMessage()); }
/** * A constructor that creates a MailImpl with the specified name, * sender, recipients, and MimeMessage. * * @param name the name of the MailImpl * @param sender the sender for this MailImpl * @param recipients the collection of recipients of this MailImpl * @param message the MimeMessage associated with this MailImpl */ public MailImpl(String name, MailAddress sender, Collection recipients, MimeMessage message) throws MessagingException { this(name, sender, recipients); this.setMessage(new MimeMessageCopyOnWriteProxy(message)); }
/** * Write the headers to an output stream * * @param out the OutputStream to which to write the headers */ public void writeTo(OutputStream out) throws MessagingException{ MimeMessageUtil.writeHeadersTo(getAllHeaderLines(), out); }
/** * Gets the user executing this session. * * @return not null */ public User getUser() { return User.fromUsername(userName); }
/** * Use this simple constructor to create a new Domain. * * @param name * the name of the Domain */ public JPADomain(Domain name) { this.name = name.asString(); }
/** * Check the number of references over the MimeMessage and clone it if * needed before returning the reference * * @throws MessagingException * exception */ protected synchronized MimeMessage getWrappedMessageForWriting() throws MessagingException { if (refCount.getReferenceCount() > 1) { refCount.decrementReferenceCount(); refCount = new MessageReferenceTracker(new MimeMessageWrapper(refCount.getWrapped())); } return refCount.getWrapped(); }
public User withDefaultDomain(Optional<Domain> defaultDomain) { if (hasDomainPart()) { return this; } return new User(localPart, defaultDomain); }
@SuppressWarnings("deprecation") public static MaybeSender of(MailAddress mailAddress) { return new MaybeSender(Optional.ofNullable(mailAddress) .filter(address -> !address.isNullSender())); }
/** * Rewritten for optimization purposes */ public void writeTo(OutputStream os, String[] ignoreList) throws IOException, MessagingException { writeTo(os, os, ignoreList); }
@Override public int read() throws IOException { if (currLine == null || pos == currLine.length) { if (readNextLine() == false) { return -1; } } return currLine[pos++]; }
/** * Return wrapped mimeMessage * * @return wrapped return the wrapped mimeMessage */ public synchronized MimeMessage getWrappedMessage() { return refCount.getWrapped(); }
/** * Returns the source ID of the MimeMessageSource that is supplying this * with data. * @see MimeMessageSource */ public synchronized String getSourceId() { return source != null ? source.getSourceId() : null; }
/** * @see org.apache.avalon.framework.activity.Disposable#dispose() */ public synchronized void dispose() { if (refCount != null) { refCount.decrementReferenceCount(); refCount = null; } }
/** * Create a copy of the input mail and assign it a new name * * @param mail original mail * @throws MessagingException when the message is not clonable */ public MailImpl(Mail mail) throws MessagingException { this(mail, newName(mail)); }
/** * @param original * MimeMessageSource * @throws MessagingException */ public MimeMessageCopyOnWriteProxy(MimeMessageSource original) throws MessagingException { this(new MimeMessageWrapper(original), true); }
/** * Duplicate the MailImpl. * * @return a MailImpl that is a duplicate of this one */ public Mail duplicate() { return duplicate(name); } /**
/** * Write */ public void writeTo(OutputStream headerOs, OutputStream bodyOs) throws IOException, MessagingException { writeTo(headerOs, bodyOs, new String[0]); }