Class LineReader

java.lang.Object
uk.ac.starlink.ecsv.LineReader
All Implemented Interfaces:
Closeable, AutoCloseable

public abstract class LineReader extends Object implements Closeable
Reads lines of text from an input stream.
Since:
28 Apr 2020
Author:
Mark Taylor
  • Constructor Details

    • LineReader

      protected LineReader(InputStream in)
      Constructor.
      Parameters:
      in - underlying input stream
  • Method Details

    • readLine

      public abstract String readLine() throws IOException
      Returns the next non-empty line of text from the input stream. The line will not consist of only whitespace.
      Returns:
      non-blank line, or null if the input is at an end
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • createAsciiLineReader

      public static LineReader createAsciiLineReader(InputStream in)
      Returns a LineReader instance that just uses the lower 7 bits of each input byte for character values.
      Parameters:
      in - input stream
      Returns:
      line reader
    • createArrayLineReader

      public static LineReader createArrayLineReader(String[] lines)
      Returns a LineReader instance that reads lines from an array.
      Parameters:
      lines - line array
      Returns:
      line reader