public class DelimitedTextCursor extends AbstractPollingCursor<java.lang.String[]>
Constructor and Description |
---|
DelimitedTextCursor(java.io.BufferedReader in,
java.util.regex.Pattern delim)
Construct a cursor reading text from a scanner with a regex delimiter.
|
DelimitedTextCursor(java.io.BufferedReader in,
java.lang.String delim)
Construct a cursor reading text from a scanner with a fixed delimiter.
|
DelimitedTextCursor(java.io.File file,
java.lang.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
AbstractPollingCursor.next() . |
java.lang.String[] |
poll()
Return the next element in this Cursor, or null if there are no more
elements.
|
copy, fastNext, hasNext, next
fast, getRowCount, iterator
public DelimitedTextCursor(@WillCloseWhenClosed @Nonnull java.io.BufferedReader in, @Nonnull java.util.regex.Pattern delim)
in
- The input scanner.delim
- The delimiter.public DelimitedTextCursor(@WillCloseWhenClosed @Nonnull java.io.BufferedReader in, @Nonnull java.lang.String delim)
in
- The scanner to read from.delim
- The delimiter string.public DelimitedTextCursor(java.io.File file, @Nonnull java.lang.String delim) throws java.io.FileNotFoundException
file
- The name of the file to read.delim
- The delimiter.java.io.FileNotFoundException
- if file is not found.public java.lang.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<java.lang.String[]>
public int getLineNumber()
AbstractPollingCursor.next()
.public void close()
AbstractCursor
Cursor.close()
method.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Cursor<java.lang.String[]>
close
in class AbstractCursor<java.lang.String[]>