Package org.apache.james.mime4j.io
Class EOLConvertingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.james.mime4j.io.EOLConvertingInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class EOLConvertingInputStream extends java.io.InputStreamInputStream which converts\rbytes not followed by\nand\nnot preceded by\rto\r\n.
-
-
Field Summary
Fields Modifier and Type Field Description static intCONVERT_BOTHConverts single '\r' and '\n' to '\r\n'static intCONVERT_CRConverts single '\r' to '\r\n'static intCONVERT_LFConverts single '\n' to '\r\n'private intflagsprivate java.io.PushbackInputStreaminprivate intprevious
-
Constructor Summary
Constructors Constructor Description EOLConvertingInputStream(java.io.InputStream in)Creates a newEOLConvertingInputStreaminstance converting bytes in the givenInputStream.EOLConvertingInputStream(java.io.InputStream in, int flags)Creates a newEOLConvertingInputStreaminstance converting bytes in the givenInputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying stream.intread()
-
-
-
Field Detail
-
CONVERT_CR
public static final int CONVERT_CR
Converts single '\r' to '\r\n'- See Also:
- Constant Field Values
-
CONVERT_LF
public static final int CONVERT_LF
Converts single '\n' to '\r\n'- See Also:
- Constant Field Values
-
CONVERT_BOTH
public static final int CONVERT_BOTH
Converts single '\r' and '\n' to '\r\n'- See Also:
- Constant Field Values
-
in
private java.io.PushbackInputStream in
-
previous
private int previous
-
flags
private int flags
-
-
Constructor Detail
-
EOLConvertingInputStream
public EOLConvertingInputStream(java.io.InputStream in)
Creates a newEOLConvertingInputStreaminstance converting bytes in the givenInputStream. The flagCONVERT_BOTHis the default.- Parameters:
in- theInputStreamto read from.
-
EOLConvertingInputStream
public EOLConvertingInputStream(java.io.InputStream in, int flags)Creates a newEOLConvertingInputStreaminstance converting bytes in the givenInputStream.- Parameters:
in- theInputStreamto read from.flags- one ofCONVERT_CR,CONVERT_LForCONVERT_BOTH.
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionCloses the underlying stream.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException- on I/O errors.
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException- See Also:
InputStream.read()
-
-