Package uk.ac.starlink.ecsv
Class LineReader
java.lang.Object
uk.ac.starlink.ecsv.LineReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
Reads lines of text from an input stream.
- Since:
- 28 Apr 2020
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static LineReader
createArrayLineReader
(String[] lines) Returns a LineReader instance that reads lines from an array.static LineReader
Returns a LineReader instance that just uses the lower 7 bits of each input byte for character values.abstract String
readLine()
Returns the next non-empty line of text from the input stream.
-
Constructor Details
-
LineReader
Constructor.- Parameters:
in
- underlying input stream
-
-
Method Details
-
readLine
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
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
createAsciiLineReader
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
Returns a LineReader instance that reads lines from an array.- Parameters:
lines
- line array- Returns:
- line reader
-