org.apache.james.util
Class ExtraDotOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.apache.james.util.ExtraDotOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class ExtraDotOutputStream
extends java.io.FilterOutputStream

Adds extra dot if dot occurs in message body at beginning of line (according to RFC1939) Compare also org.apache.james.smtpserver.SMTPInputStream


Field Summary
protected  int countLast0A0D
          Counter for number of last (0A or 0D).
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ExtraDotOutputStream(java.io.OutputStream out)
          Constructor that wraps an OutputStream.
 
Method Summary
 void checkCRLFTerminator()
          Ensure that the stream is CRLF terminated.
 void write(int b)
          Writes a byte to the stream, adding dots where appropriate.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

countLast0A0D

protected int countLast0A0D
Counter for number of last (0A or 0D).

Constructor Detail

ExtraDotOutputStream

public ExtraDotOutputStream(java.io.OutputStream out)
Constructor that wraps an OutputStream.

Parameters:
out - the OutputStream to be wrapped
Method Detail

write

public void write(int b)
           throws java.io.IOException
Writes a byte to the stream, adding dots where appropriate. Also fixes any naked CR or LF to the RFC 2821 mandated CFLF pairing.

Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - the byte to write
Throws:
java.io.IOException - if an error occurs writing the byte

checkCRLFTerminator

public void checkCRLFTerminator()
                         throws java.io.IOException
Ensure that the stream is CRLF terminated.

Throws:
java.io.IOException - if an error occurs writing the byte


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.