Package uk.ac.starlink.ecsv
Class LineReader
- java.lang.Object
-
- uk.ac.starlink.ecsv.LineReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public abstract class LineReader extends java.lang.Object implements java.io.Closeable
Reads lines of text from an input stream.- Since:
- 28 Apr 2020
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LineReader(java.io.InputStream in)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
static LineReader
createArrayLineReader(java.lang.String[] lines)
Returns a LineReader instance that reads lines from an array.static LineReader
createAsciiLineReader(java.io.InputStream in)
Returns a LineReader instance that just uses the lower 7 bits of each input byte for character values.abstract java.lang.String
readLine()
Returns the next non-empty line of text from the input stream.
-
-
-
Method Detail
-
readLine
public abstract java.lang.String readLine() throws java.io.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:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
createAsciiLineReader
public static LineReader createAsciiLineReader(java.io.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(java.lang.String[] lines)
Returns a LineReader instance that reads lines from an array.- Parameters:
lines
- line array- Returns:
- line reader
-
-