Copyright 2002 by aragost

com.aragost.util
Class EscapingStringTokenizer

java.lang.Object
  |
  +--com.aragost.util.EscapingStringTokenizer
All Implemented Interfaces:
java.util.Iterator

public class EscapingStringTokenizer
extends java.lang.Object
implements java.util.Iterator


Field Summary
static char DEFAULT_ESCAPE
          The default escape character
 
Constructor Summary
EscapingStringTokenizer(java.lang.String s, java.lang.String delimiters)
          Creates new EscapableStringTokenizer
EscapingStringTokenizer(java.lang.String s, java.lang.String delimiters, char escapeChar)
          Creates new EscapableStringTokenizer
 
Method Summary
 java.lang.String getDelimiters()
          Getter for property delimiters.
 char getEscapeCharacter()
          Getter for property escapeCharacter.
 boolean hasNext()
          Returns true if the iteration has more elements.
 boolean isUnescaping()
          Getter for property unescaping.
 java.lang.Object next()
          Returns the next element in the interation.
 java.lang.String nextToken()
           
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 void setDelimiters(java.lang.String delimiters)
          Setter for property delimiters.
 void setEscapeCharacter(char escapeCharacter)
          Setter for property escapeCharacter.
 void setUnescaping(boolean unescaping)
          Setter for property unescaping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ESCAPE

public static final char DEFAULT_ESCAPE
The default escape character

See Also:
Constant Field Values
Constructor Detail

EscapingStringTokenizer

public EscapingStringTokenizer(java.lang.String s,
                               java.lang.String delimiters,
                               char escapeChar)
Creates new EscapableStringTokenizer


EscapingStringTokenizer

public EscapingStringTokenizer(java.lang.String s,
                               java.lang.String delimiters)
Creates new EscapableStringTokenizer

Method Detail

isUnescaping

public boolean isUnescaping()
Getter for property unescaping. Indicates if escape characters should be removed from the tokens returned by nextToken. Default is true.

Returns:
Value of property unescaping.
See Also:
setUnescaping(boolean unescaping)

setUnescaping

public void setUnescaping(boolean unescaping)
Setter for property unescaping.

Parameters:
unescaping - New value of property unescaping.
See Also:
isUnescaping()

hasNext

public boolean hasNext()
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements.

next

public java.lang.Object next()
Returns the next element in the interation.

Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration.
Throws:
java.util.NoSuchElementException - iteration has no more elements.

nextToken

public java.lang.String nextToken()

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - if the remove operation is not supported by this Iterator.
java.lang.IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method.

getEscapeCharacter

public char getEscapeCharacter()
Getter for property escapeCharacter.

Returns:
Value of property escapeCharacter.

setEscapeCharacter

public void setEscapeCharacter(char escapeCharacter)
Setter for property escapeCharacter.

Parameters:
escapeCharacter - New value of property escapeCharacter.

getDelimiters

public java.lang.String getDelimiters()
Getter for property delimiters.

Returns:
Value of property delimiters.

setDelimiters

public void setDelimiters(java.lang.String delimiters)
Setter for property delimiters.

Parameters:
delimiters - New value of property delimiters.

Copyright 2002 by aragost