net.sf.xbus.base.core
Class ASCIITokenizer

java.lang.Object
  extended by java.util.StringTokenizer
      extended by net.sf.xbus.base.core.ASCIITokenizer
All Implemented Interfaces:
java.util.Enumeration<java.lang.Object>

public class ASCIITokenizer
extends java.util.StringTokenizer

A StringTokenizer, that conveniently tokenizes a ASCII-file The main difference to its base class is, that it doesnīt count the delimiters as tokens in method countTokens() and that its methods nextElement() and nextToken() donīt return a delimiter, but an empty Object/String if there are two delimiters next to each other.

Author:
Martin Sturzenhecker
See Also:
StringTokenizer

Constructor Summary
ASCIITokenizer(java.lang.String str, java.lang.String delim)
          Creates a new instance of ASCIIOfferTokenizer
 
Method Summary
 int countTokens()
          Counts the number of tokens in the string to be tokenized The delimiters are not counted unlike in class StringTokenizer
 java.lang.String getDelimiters()
          Returns the delimiters of this tokenizer
 java.lang.String getStr()
          Returns the string to be tokenized
 java.lang.Object nextElement()
          Returns the next element of the string to be tokenized It does quite the same as the method nextToken() but it returns an Object instead of a String
 java.lang.String nextToken()
          Returns the next token of the string to be tokenized
 
Methods inherited from class java.util.StringTokenizer
hasMoreElements, hasMoreTokens, nextToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASCIITokenizer

public ASCIITokenizer(java.lang.String str,
                      java.lang.String delim)
Creates a new instance of ASCIIOfferTokenizer

Parameters:
str - String to be tokenized
delim - String separator
Method Detail

countTokens

public int countTokens()
Counts the number of tokens in the string to be tokenized

The delimiters are not counted unlike in class StringTokenizer

Overrides:
countTokens in class java.util.StringTokenizer
Returns:
int - the number of tokens without the delimiters

getDelimiters

public java.lang.String getDelimiters()
Returns the delimiters of this tokenizer

Returns:
String -the delimiters of this tokenizer

getStr

public java.lang.String getStr()
Returns the string to be tokenized

Returns:
String to be tokenized

nextElement

public java.lang.Object nextElement()
Returns the next element of the string to be tokenized

It does quite the same as the method nextToken() but it returns an Object instead of a String

Specified by:
nextElement in interface java.util.Enumeration<java.lang.Object>
Overrides:
nextElement in class java.util.StringTokenizer
Returns:
Object - the next element of the string
See Also:
nextToken()

nextToken

public java.lang.String nextToken()
Returns the next token of the string to be tokenized

Overrides:
nextToken in class java.util.StringTokenizer
Returns:
String - the next token of the string