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.ReaderThis 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
BufferedReaderin 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 voidclose()java.lang.StringgetDetectedEol()booleanhasMixedEol()intread(char[] cbuf, int off, int len)java.lang.StringreadLine()
-
-
-
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:
readin 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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader- Throws:
java.io.IOException
-
-