Package org.omegat.util
Class MixedEolHandlingReader
- java.lang.Object
-
- java.io.Reader
-
- org.omegat.util.MixedEolHandlingReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Readable
public class MixedEolHandlingReader extends java.io.Reader
This reader tries to detect the correct EOL type for the input stream based on the frequency of EOL chars encountered within a lookahead range. CallingreadLine()
will return lines that include "bad" EOL chars.For example an input that is detected to be CRLF that contains a line "foo\r\r\n" will return "foo\r" for that line. This differs from
BufferedReader
in that the latter will treat all EOL chars as starting new lines, so the above example would give "foo" and then "".
-
-
Constructor Summary
Constructors Constructor Description MixedEolHandlingReader(java.io.Reader in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
java.lang.String
getDetectedEol()
boolean
hasMixedEol()
int
read(char[] cbuf, int off, int len)
java.lang.String
readLine()
-
-
-
Method Detail
-
getDetectedEol
public java.lang.String getDetectedEol()
-
hasMixedEol
public boolean hasMixedEol()
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException
- Specified by:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
readLine
public java.lang.String readLine() throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Reader
- Throws:
java.io.IOException
-
-