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.CloseableReads lines of text from an input stream.- Since:
- 28 Apr 2020
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLineReader(java.io.InputStream in)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()static LineReadercreateArrayLineReader(java.lang.String[] lines)Returns a LineReader instance that reads lines from an array.static LineReadercreateAsciiLineReader(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.StringreadLine()Returns the next non-empty line of text from the input stream.
-
-
-
Method Detail
-
readLine
public abstract java.lang.String readLine() throws java.io.IOExceptionReturns 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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein 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
-
-