public class DelimitedTextCursor extends AbstractCursor<String[]>
Constructor and Description |
---|
DelimitedTextCursor(BufferedReader in,
Pattern delim)
Construct a cursor reading text from a scanner with a regex delimiter.
|
DelimitedTextCursor(BufferedReader in,
String delim)
Construct a cursor reading text from a scanner with a fixed delimiter.
|
DelimitedTextCursor(File file,
String delim)
Construct a delimited text cursor from a file.
|
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
next() . |
boolean |
hasNext()
Query whether the cursor has any more items.
|
String[] |
next()
Fetch the next item from the cursor.
|
fast, fastNext, getRowCount, iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DelimitedTextCursor(@WillCloseWhenClosed @Nonnull BufferedReader in, @Nonnull Pattern delim)
in
- The input scanner.delim
- The delimiter.public DelimitedTextCursor(@WillCloseWhenClosed @Nonnull BufferedReader in, @Nonnull String delim)
in
- The scanner to read from.delim
- The delimiter string.public DelimitedTextCursor(File file, @Nonnull String delim) throws FileNotFoundException
file
- The name of the file to read.delim
- The delimiter.FileNotFoundException
- if file is not found.public boolean hasNext()
Cursor
true
if there remains another item to fetch.@Nonnull public String[] next()
Cursor
public int getLineNumber()
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[]>