Class LineNumberReader


  • public class LineNumberReader
    extends java.lang.Object
    Replacement for LineNumberReader. This class provides a workaround for an incompatibility in the LineNumberReader: If the last line in a file isn't terminated with LF, or CR, or CRLF, then that line is counted in Java 16, and beyond, but wasn't counted before. This implementation is compatible with the latter variant, thus providing upwards compatibility for RAT.
    • Constructor Summary

      Constructors 
      Constructor Description
      LineNumberReader​(java.io.Reader pReader)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getLineNumber()  
      int read()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • parent

        private final java.io.Reader parent
      • previousCharWasCR

        private boolean previousCharWasCR
      • lineNumber

        private int lineNumber
    • Constructor Detail

      • LineNumberReader

        public LineNumberReader​(java.io.Reader pReader)
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getLineNumber

        public int getLineNumber()