Class 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. Calling readLine() 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 "".

    • 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()  
      • Methods inherited from class java.io.Reader

        mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MixedEolHandlingReader

        public MixedEolHandlingReader​(java.io.Reader in)
                               throws java.io.IOException
        Throws:
        java.io.IOException
    • 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 class java.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 interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Reader
        Throws:
        java.io.IOException