Holger's
Java API

com.antelmann.cddb
Class ArgumentParser

java.lang.Object
  extended by com.antelmann.cddb.ArgumentParser
All Implemented Interfaces:
Serializable

public class ArgumentParser
extends Object
implements Serializable

ArgumentParser is a helper class that parses arguments in results according to CDDB Protocol level 2. It works similarly to a StringTokenizer, but it properly handles arguments enclosed with quotes, i.e. delimiters are not recognized if the occurrence is within a quoted section.

Author:
Holger Antelmann
See Also:
StringTokenizer, Serialized Form

Field Summary
protected  String delimiter
          protected to allow custom delimiters for subclasses
 
Constructor Summary
ArgumentParser(String line)
           
ArgumentParser(String line, int startingPosition)
           
ArgumentParser(String line, String delimiter)
           
 
Method Summary
static String[] getAll(String line)
           
static String[] getAll(String line, String delimiter)
           
 boolean hasMoreArguments()
           
 String nextArgument()
           
 String remainder()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delimiter

protected String delimiter
protected to allow custom delimiters for subclasses

Constructor Detail

ArgumentParser

public ArgumentParser(String line)

ArgumentParser

public ArgumentParser(String line,
                      String delimiter)

ArgumentParser

public ArgumentParser(String line,
                      int startingPosition)
Method Detail

remainder

public String remainder()

getAll

public static String[] getAll(String line)

getAll

public static String[] getAll(String line,
                              String delimiter)

hasMoreArguments

public boolean hasMoreArguments()

nextArgument

public String nextArgument()
                    throws NoSuchElementException
Throws:
NoSuchElementException


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads