org.sadun.util
Class QuoteAwareStringTokenizer

java.lang.Object
  extended byorg.sadun.util.QuoteAwareStringTokenizer
All Implemented Interfaces:
java.util.Enumeration

public class QuoteAwareStringTokenizer
extends java.lang.Object
implements java.util.Enumeration

A StringTokenizer-compatible class which takes quotes into account.

The tokenizer behaves like StringTokenizer, except that it accepts a set of quote pairs indicating opening and closing quote character (denoted, at construction, by a String containing the pairs consecutively: ()[] for example) and returns quoted portions of the string as single tokens.

Author:
Cristiano Sadun

Constructor Summary
QuoteAwareStringTokenizer(java.lang.String str)
           
QuoteAwareStringTokenizer(java.lang.String str, java.lang.String delim)
           
QuoteAwareStringTokenizer(java.lang.String str, java.lang.String delim, boolean returnDelims)
           
QuoteAwareStringTokenizer(java.lang.String str, java.lang.String delim, java.lang.String quotePairs)
           
QuoteAwareStringTokenizer(java.lang.String str, java.lang.String delim, java.lang.String quotePairs, boolean returnDelims)
           
 
Method Summary
 int countTokens()
           
 boolean hasMoreElements()
           
 boolean hasMoreTokens()
           
 java.lang.Object nextElement()
           
 java.lang.String nextToken()
           
 java.lang.String nextToken(java.lang.String delim)
           
 java.lang.String nextToken(java.lang.String delim, java.lang.String quotePairs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuoteAwareStringTokenizer

public QuoteAwareStringTokenizer(java.lang.String str,
                                 java.lang.String delim,
                                 java.lang.String quotePairs,
                                 boolean returnDelims)

QuoteAwareStringTokenizer

public QuoteAwareStringTokenizer(java.lang.String str,
                                 java.lang.String delim,
                                 java.lang.String quotePairs)

QuoteAwareStringTokenizer

public QuoteAwareStringTokenizer(java.lang.String str,
                                 java.lang.String delim,
                                 boolean returnDelims)

QuoteAwareStringTokenizer

public QuoteAwareStringTokenizer(java.lang.String str,
                                 java.lang.String delim)

QuoteAwareStringTokenizer

public QuoteAwareStringTokenizer(java.lang.String str)
Method Detail

countTokens

public int countTokens()
Returns:

nextToken

public java.lang.String nextToken()
Returns:

nextElement

public java.lang.Object nextElement()
Specified by:
nextElement in interface java.util.Enumeration

hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface java.util.Enumeration

hasMoreTokens

public boolean hasMoreTokens()
Returns:

nextToken

public java.lang.String nextToken(java.lang.String delim,
                                  java.lang.String quotePairs)

nextToken

public java.lang.String nextToken(java.lang.String delim)