public class CSVTokenizer extends Object implements Tokenizer<String>, Enumeration<String>, Iterator<String>, Iterable<String>
StringTokenizer.
In addition to StringTokenizer's two interfaces, this class also supports the
Iterator interface.
It supports too many style of iterations as a result:
StringTokenizer| Constructor and Description |
|---|
CSVTokenizer(String line)
Creates a tokenizer from the specified CSV line.
|
| Modifier and Type | Method and Description |
|---|---|
int |
countTokens()
Indicates how many tokens are left.
|
boolean |
hasMoreElements() |
boolean |
hasMoreTokens()
Indicates if more tokens are available.
|
boolean |
hasNext() |
Iterator<String> |
iterator() |
String |
next() |
String |
nextElement() |
String |
nextToken()
Returns the next token.
|
void |
remove()
Not supported.
|
void |
reset()
Reset the iterator back to the beginning.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingforEach, spliteratorpublic CSVTokenizer(String line) throws ParseException
line - string to tokenizeParseException - if the line cannot be tokenizedpublic String nextToken()
public boolean hasMoreTokens()
hasMoreTokens in interface Tokenizer<String>public int countTokens()
Tokenizer.nextToken() will cause the count to reduce.countTokens in interface Tokenizer<String>public boolean hasMoreElements()
hasMoreElements in interface Enumeration<String>public String nextElement()
nextElement in interface Enumeration<String>public void remove()
remove in interface Iterator<String>RuntimeException - always thrownpublic void reset()
Copyright © 2020. All Rights Reserved.