Package org.apache.james.mime4j.io
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\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'
-
Constructor Summary
Constructors Constructor Description EOLConvertingInputStream(InputStream in)Creates a newEOLConvertingInputStreaminstance converting bytes in the givenInputStream.EOLConvertingInputStream(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()-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
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
-
-
Constructor Detail
-
EOLConvertingInputStream
public EOLConvertingInputStream(InputStream in)
Creates a newEOLConvertingInputStreaminstance converting bytes in the givenInputStream. The flagCONVERT_BOTHis the default.- Parameters:
in- theInputStreamto read from.
-
EOLConvertingInputStream
public EOLConvertingInputStream(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 IOExceptionCloses the underlying stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- on I/O errors.
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException- See Also:
InputStream.read()
-
-