public class LineCursor extends AbstractPollingCursor<String>
Constructor and Description |
---|
LineCursor(BufferedReader in)
Construct a cursor reading lines from a buffered reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
No-op implementation of the
Cursor.close() method. |
int |
getLineNumber()
Return the number of the line returned by the last call to
AbstractPollingCursor.next() . |
static LineCursor |
openFile(File file)
Open a delimited text cursor as a file.
|
static LineCursor |
openFile(File file,
CompressionMode comp)
Open a delimited text cursor as a file.
|
String |
poll()
Return the next element in this Cursor, or null if there are no more
elements.
|
copy, fastNext, hasNext, next
fast, getRowCount, iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public LineCursor(@WillCloseWhenClosed @Nonnull BufferedReader in)
in
- The input reader.public static LineCursor openFile(File file) throws FileNotFoundException
file
- The file to open.FileNotFoundException
- if there is an error opening the file.public static LineCursor openFile(File file, CompressionMode comp) throws IOException
file
- The file to open.FileNotFoundException
- if there is an error opening the file.IOException
public String poll()
AbstractPollingCursor
AbstractPollingCursor.copy(Object)
copies objects. If this
method returns a fresh object every time, then AbstractPollingCursor.copy(Object)
should be a no-op.poll
in class AbstractPollingCursor<String>
public int getLineNumber()
AbstractPollingCursor.next()
.public void close()
AbstractCursor
Cursor.close()
method.close
in interface Closeable
close
in interface AutoCloseable
close
in interface Cursor<String>
close
in class AbstractCursor<String>