org.apache.james.util.stream
Class ExtraDotOutputStream

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

public class ExtraDotOutputStream
extends CRLFOutputStream

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
 
Fields inherited from class org.apache.james.util.stream.CRLFOutputStream
LAST_WAS_CR, LAST_WAS_LF, LAST_WAS_OTHER, startOfLine, statusLast
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ExtraDotOutputStream(java.io.OutputStream out)
          Constructor that wraps an OutputStream.
 
Method Summary
 void write(int b)
          Writes a byte to the stream, adding dots where appropriate.
protected  void writeChunk(byte[] buffer, int offset, int length)
          Overrides super writeChunk in order to add a "." if the previous chunk ended with a new line and a new chunk starts with "."
 
Methods inherited from class org.apache.james.util.stream.CRLFOutputStream
checkCRLFTerminator, write
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtraDotOutputStream

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

Parameters:
out - the OutputStream to be wrapped
Method Detail

writeChunk

protected void writeChunk(byte[] buffer,
                          int offset,
                          int length)
                   throws java.io.IOException
Overrides super writeChunk in order to add a "." if the previous chunk ended with a new line and a new chunk starts with "."

Overrides:
writeChunk in class CRLFOutputStream
Throws:
java.io.IOException
See Also:
CRLFOutputStream.writeChunk(byte[], int, int)

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 CRLF pairing.

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


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