au.gov.tas.dpiwe.mr.util
Class CSVLineTokenizer

java.lang.Object
  extended by java.util.StringTokenizer
      extended by au.gov.tas.dpiwe.mr.util.CSVLineTokenizer
All Implemented Interfaces:
Enumeration

public class CSVLineTokenizer
extends StringTokenizer

Tokenizes lines of a CSV (comma-separated value) file.

Since:
Mr Architecture 1.7
Version:
1.0.0.1
Author:
Kade Hansson

Constructor Summary
CSVLineTokenizer(String line)
          Construct a new CSVLineTokenizer.
 
Method Summary
 int countTokens()
          This operation is not supported.
 boolean hasMoreElements()
          Returns true if there are more comma-separated values on the line.
 boolean hasMoreTokens()
          Returns true if there are more comma-separated values on the line.
 Object nextElement()
          Returns the next comma-separated value on the line.
 String nextToken()
          Returns the next comma-separated value on the line.
 String nextToken(String delim)
          This operation is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVLineTokenizer

public CSVLineTokenizer(String line)
Construct a new CSVLineTokenizer.

Parameters:
line - the line of comma-separated values to be tokenized.
Method Detail

nextToken

public String nextToken()
Returns the next comma-separated value on the line.

Numbers are unparsed. Strings in CSV may be quoted using double quotes- these are removed and any commas in the string passed through untouched. Double quote images are returned as double quotes.

Overrides:
nextToken in class StringTokenizer
Returns:
the next comma-separated value on the line.
Throws:
NoSuchElementException - if there are no more values on the line.

nextToken

public String nextToken(String delim)
This operation is not supported.

Overrides:
nextToken in class StringTokenizer
Returns:
never.
Throws:
UnsupportedOperationException - always.

hasMoreTokens

public boolean hasMoreTokens()
Returns true if there are more comma-separated values on the line.

Overrides:
hasMoreTokens in class StringTokenizer
Returns:
true if there are more comma-separated values on the line, false otherwise.

nextElement

public Object nextElement()
Returns the next comma-separated value on the line.

Numbers are unparsed. Strings in CSV may be quoted using double quotes- these are removed and any commas in the string passed through untouched. Double quote images are returned as double quotes.

Specified by:
nextElement in interface Enumeration
Overrides:
nextElement in class StringTokenizer
Returns:
the next comma-separated value on the line.
Throws:
NoSuchElementException - if there are no more values on the line.

hasMoreElements

public boolean hasMoreElements()
Returns true if there are more comma-separated values on the line.

Specified by:
hasMoreElements in interface Enumeration
Overrides:
hasMoreElements in class StringTokenizer
Returns:
true if there are more comma-separated values on the line, false otherwise.

countTokens

public int countTokens()
This operation is not supported.

Overrides:
countTokens in class StringTokenizer
Returns:
never.
Throws:
UnsupportedOperationException - always.