Class LineReader

java.lang.Object
org.commonmark.internal.util.LineReader
All Implemented Interfaces:
Closeable, AutoCloseable

public class LineReader extends Object implements Closeable
Reads lines from a reader like BufferedReader but also returns the line terminators.

Line terminators can be either a line feed "\n", carriage return "\r", or a carriage return followed by a line feed "\r\n". Call getLineTerminator() after readLine() to obtain the corresponding line terminator. If a stream has a line at the end without a terminator, getLineTerminator() returns null.

  • Field Details

    • CHAR_BUFFER_SIZE

      static final int CHAR_BUFFER_SIZE
      See Also:
    • EXPECTED_LINE_LENGTH

      static final int EXPECTED_LINE_LENGTH
      See Also:
    • reader

      private Reader reader
    • cbuf

      private char[] cbuf
    • position

      private int position
    • limit

      private int limit
    • lineTerminator

      private String lineTerminator
  • Constructor Details

    • LineReader

      public LineReader(Reader reader)
  • Method Details