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
InputStream which converts
\r
bytes not followed by \n
and \n
not
preceded by \r
to \r\n
.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Converts single '\r' and '\n' to '\r\n'static final int
Converts single '\r' to '\r\n'static final int
Converts single '\n' to '\r\n'private int
private PushbackInputStream
private int
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
.EOLConvertingInputStream
(InputStream in, int flags) Creates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
. -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
CONVERT_CR
public static final int CONVERT_CRConverts single '\r' to '\r\n'- See Also:
-
CONVERT_LF
public static final int CONVERT_LFConverts single '\n' to '\r\n'- See Also:
-
CONVERT_BOTH
public static final int CONVERT_BOTHConverts single '\r' and '\n' to '\r\n'- See Also:
-
in
-
previous
private int previous -
flags
private int flags
-
-
Constructor Details
-
EOLConvertingInputStream
Creates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
. The flagCONVERT_BOTH
is the default.- Parameters:
in
- theInputStream
to read from.
-
EOLConvertingInputStream
Creates a newEOLConvertingInputStream
instance converting bytes in the givenInputStream
.- Parameters:
in
- theInputStream
to read from.flags
- one ofCONVERT_CR
,CONVERT_LF
orCONVERT_BOTH
.
-
-
Method Details
-
close
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
- Specified by:
read
in classInputStream
- Throws:
IOException
- See Also:
-