Class EOLConvertingInputStream

java.lang.Object
java.io.InputStream
org.apache.james.mime4j.io.EOLConvertingInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class EOLConvertingInputStream extends InputStream
InputStream which converts \r bytes not followed by \n and \n not preceded by \r to \r\n.
  • Field Details

    • CONVERT_CR

      public static final int CONVERT_CR
      Converts single '\r' to '\r\n'
      See Also:
    • CONVERT_LF

      public static final int CONVERT_LF
      Converts single '\n' to '\r\n'
      See Also:
    • CONVERT_BOTH

      public static final int CONVERT_BOTH
      Converts single '\r' and '\n' to '\r\n'
      See Also:
    • in

      private PushbackInputStream in
    • previous

      private int previous
    • flags

      private int flags
  • Constructor Details

    • EOLConvertingInputStream

      public EOLConvertingInputStream(InputStream in)
      Creates a new EOLConvertingInputStream instance converting bytes in the given InputStream. The flag CONVERT_BOTH is the default.
      Parameters:
      in - the InputStream to read from.
    • EOLConvertingInputStream

      public EOLConvertingInputStream(InputStream in, int flags)
      Creates a new EOLConvertingInputStream instance converting bytes in the given InputStream.
      Parameters:
      in - the InputStream to read from.
      flags - one of CONVERT_CR, CONVERT_LF or CONVERT_BOTH.
  • Method Details