org.mailster.message
Class SmtpMessageFactory

java.lang.Object
  extended by org.mailster.message.SmtpMessageFactory

public class SmtpMessageFactory
extends java.lang.Object

---
Mailster (C) 2007-2009 De Oliveira Edouard

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

See  Mailster Web Site
---

SmtpMessageFactory.java - This class creates a SmtpMessage from an InputStream.

Version:
$Revision: 1.4 $, $Date: 2009/02/08 01:02:49 $
Author:
Edouard De Oliveira

Field Summary
private  java.nio.charset.Charset charset
           
private  java.nio.charset.CharsetDecoder decoder
           
private  org.apache.mina.core.buffer.IoBuffer delimBuf
           
private  boolean isHeaderLine
           
private static org.slf4j.Logger log
           
private  boolean previousLineInHeader
          Decoding vars.
 
Constructor Summary
SmtpMessageFactory()
          Creates a new instance with the current default Charset, the LineDelimiter.CRLF delimiter.
SmtpMessageFactory(java.nio.charset.Charset charset)
          Creates a new instance with the specified charset and the LineDelimiter.CRLF delimiter.
SmtpMessageFactory(java.nio.charset.Charset charset, org.apache.mina.filter.codec.textline.LineDelimiter delimiter)
          Creates a new instance with the specified charset and the specified delimiter.
 
Method Summary
private  void addRecipientsFromHeader(SmtpMessage msg, java.util.HashSet<java.lang.String> set, java.lang.String headerName)
           
 SmtpMessage asSmtpMessage(java.io.InputStream data, java.util.List<java.lang.String> recipients)
           
private  boolean consume(SmtpMessage msg, org.apache.mina.core.buffer.IoBuffer in)
           
private  void reset()
           
private  void updateMessage(SmtpMessage msg, org.apache.mina.core.buffer.IoBuffer in)
          Stores the data in the SmtpMessage body.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.slf4j.Logger log

delimBuf

private org.apache.mina.core.buffer.IoBuffer delimBuf

charset

private java.nio.charset.Charset charset

decoder

private java.nio.charset.CharsetDecoder decoder

previousLineInHeader

private boolean previousLineInHeader
Decoding vars.


isHeaderLine

private boolean isHeaderLine
Constructor Detail

SmtpMessageFactory

public SmtpMessageFactory()
Creates a new instance with the current default Charset, the LineDelimiter.CRLF delimiter.


SmtpMessageFactory

public SmtpMessageFactory(java.nio.charset.Charset charset)
Creates a new instance with the specified charset and the LineDelimiter.CRLF delimiter.


SmtpMessageFactory

public SmtpMessageFactory(java.nio.charset.Charset charset,
                          org.apache.mina.filter.codec.textline.LineDelimiter delimiter)
Creates a new instance with the specified charset and the specified delimiter.

Method Detail

reset

private void reset()

asSmtpMessage

public SmtpMessage asSmtpMessage(java.io.InputStream data,
                                 java.util.List<java.lang.String> recipients)
                          throws java.lang.Exception
Throws:
java.lang.Exception

addRecipientsFromHeader

private void addRecipientsFromHeader(SmtpMessage msg,
                                     java.util.HashSet<java.lang.String> set,
                                     java.lang.String headerName)

updateMessage

private void updateMessage(SmtpMessage msg,
                           org.apache.mina.core.buffer.IoBuffer in)
                    throws java.lang.Exception
Stores the data in the SmtpMessage body.

Throws:
java.lang.Exception

consume

private boolean consume(SmtpMessage msg,
                        org.apache.mina.core.buffer.IoBuffer in)
                 throws java.lang.Exception
Throws:
java.lang.Exception