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\r
bytes not followed by\n
and\n
not preceded by\r
to\r\n
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CONVERT_BOTH
Converts single '\r' and '\n' to '\r\n'static int
CONVERT_CR
Converts single '\r' to '\r\n'static int
CONVERT_LF
Converts single '\n' to '\r\n'
-
Constructor Summary
Constructors Constructor Description EOLConvertingInputStream(InputStream in)
Creates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
.EOLConvertingInputStream(InputStream in, int flags)
Creates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the underlying stream.int
read()
-
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 newEOLConvertingInputStream
instance converting bytes in the givenInputStream
. The flagCONVERT_BOTH
is the default.- Parameters:
in
- theInputStream
to read from.
-
EOLConvertingInputStream
public EOLConvertingInputStream(InputStream in, int flags)
Creates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
.- Parameters:
in
- theInputStream
to read from.flags
- one ofCONVERT_CR
,CONVERT_LF
orCONVERT_BOTH
.
-
-
Method Detail
-
close
public void close() throws IOException
Closes the underlying stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- on I/O errors.
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
- See Also:
InputStream.read()
-
-