Class CrLfInputStream


  • public class CrLfInputStream
    extends Object
    CrLfInputStream recognizes CR LF line endings but otherwise assumes arbitrary binary content. Mail content is special, because it is considered to be an octet stream, although usually it contains text. MIME mail headers can be encoded in either US-ASCII or UTF-8, but the mail body can be in any charset, moreover it can be arbitrary binary data encoded using the MIME binary method, so the result does not even similar to text. The POP3 TOP command needs to return mail headers and a few lines of the body. The latter is obsolete functionality, there may be no lines in the body, but we have to deal with this situation.
    • Constructor Summary

      Constructors 
      Constructor Description
      CrLfInputStream​(java.io.InputStream in)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int readLineWithEol​(byte[] buffer)
      Reads a line without end-of-line characters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CrLfInputStream

        public CrLfInputStream​(java.io.InputStream in)
    • Method Detail

      • readLineWithEol

        public int readLineWithEol​(byte[] buffer)
                            throws org.subethamail.smtp.io.CRLFTerminatedReader.MaxLineLengthException,
                                   java.io.IOException
        Reads a line without end-of-line characters. It recognizes but logs line endings other then CR LF.
        Throws:
        org.subethamail.smtp.io.CRLFTerminatedReader.MaxLineLengthException - if the line is longer than the length of the buffer
        java.io.IOException