Class CRLFOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.subethamail.smtp.io.CRLFOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Direct Known Subclasses:
ExtraDotOutputStream

public class CRLFOutputStream extends FilterOutputStream
A Filter for use with SMTP or other protocols in which lines must end with CRLF. Converts every "isolated" occourency of \r or \n with \r\n RFC 2821 #2.3.7 mandates that line termination is CRLF, and that CR and LF must not be transmitted except in that pairing. If we get a naked LF, convert to CRLF.
  • Field Details

    • statusLast

      protected int statusLast
      Counter for number of last (0A or 0D).
    • LAST_WAS_OTHER

      protected static final int LAST_WAS_OTHER
      See Also:
    • LAST_WAS_CR

      protected static final int LAST_WAS_CR
      See Also:
    • LAST_WAS_LF

      protected static final int LAST_WAS_LF
      See Also:
    • startOfLine

      protected boolean startOfLine
  • Constructor Details

    • CRLFOutputStream

      public CRLFOutputStream(OutputStream out)
      Constructor that wraps an OutputStream.
      Parameters:
      out - the OutputStream to be wrapped
  • Method Details