com.compoze.collab.util
Class QuotedStringTokenizer

java.lang.Object
  extended by java.util.StringTokenizer
      extended by com.compoze.collab.util.QuotedStringTokenizer
All Implemented Interfaces
Enumeration<Object>

public class QuotedStringTokenizer
extends StringTokenizer

This class implements a StringTokenizer that handles quotes.


Constructor Summary
QuotedStringTokenizer(String str)
          Constructor.
QuotedStringTokenizer(String str, String delim)
          Constructor.
QuotedStringTokenizer(String str, String delim, boolean returnTokens)
          Constructor.
QuotedStringTokenizer(String str, String delim, boolean returnTokens, boolean returnQuotes)
          Constructor.
 
Method Summary
 int countTokens()
          Gets the count of tokens.
 boolean hasMoreElements()
          Determines if there are more elements.
 boolean hasMoreTokens()
          Determines if there are more tokens.
 Object nextElement()
          Gets the next element.
 String nextToken()
          Gets the next token.
 String nextToken(String delim)
          Gets the next token using the specified delimiter.
static void quote(StringBuffer buf, String s)
          Quotes a string.
static String quote(String s, String delim)
          Quotes a string.
static String unquote(String s)
          Unquotes a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuotedStringTokenizer

public QuotedStringTokenizer(String str,
                             String delim,
                             boolean returnTokens,
                             boolean returnQuotes)
Constructor.


QuotedStringTokenizer

public QuotedStringTokenizer(String str,
                             String delim,
                             boolean returnTokens)
Constructor.


QuotedStringTokenizer

public QuotedStringTokenizer(String str,
                             String delim)
Constructor.


QuotedStringTokenizer

public QuotedStringTokenizer(String str)
Constructor.

Method Detail

hasMoreTokens

public boolean hasMoreTokens()
Determines if there are more tokens.

Overrides:
hasMoreTokens in class StringTokenizer
Returns
true if there are more tokens

nextToken

public String nextToken()
                 throws NoSuchElementException
Gets the next token.

Overrides:
nextToken in class StringTokenizer
Returns
the next token
Throws
NoSuchElementException

nextToken

public String nextToken(String delim)
                 throws NoSuchElementException
Gets the next token using the specified delimiter.

Overrides:
nextToken in class StringTokenizer
Returns
the next token
Throws
NoSuchElementException

hasMoreElements

public boolean hasMoreElements()
Determines if there are more elements.

Specified by:
hasMoreElements in interface Enumeration<Object>
Overrides:
hasMoreElements in class StringTokenizer
Returns
true if there are more elements

nextElement

public Object nextElement()
                   throws NoSuchElementException
Gets the next element.

Specified by:
nextElement in interface Enumeration<Object>
Overrides:
nextElement in class StringTokenizer
Returns
the next element
Throws
NoSuchElementException

countTokens

public int countTokens()
Gets the count of tokens.

Overrides:
countTokens in class StringTokenizer
Returns
the count of tokens

quote

public static String quote(String s,
                           String delim)
Quotes a string.

Parameters
s - the string to quote
delim - the delimiter
Returns
the quoted string

quote

public static void quote(StringBuffer buf,
                         String s)
Quotes a string.

Parameters
buf - the buffer to write to
s - the string to quote

unquote

public static String unquote(String s)
Unquotes a string.

Parameters
s - the string to unquote
Returns
the unquoted string


Copyright © 2006 BEA Systems, Inc. All Rights Reserved