org.eclipse.webdav.internal.authentication
Class Parser

java.lang.Object
  extended by org.eclipse.webdav.internal.authentication.Parser

public class Parser
extends Object

A simple parser that is mainly used to parse HTTP header fields.


Field Summary
 int pos
          The index of the next character in s to be parsed.
 String s
          The string being parsed.
 
Constructor Summary
Parser(String s)
          Creates a new parser on the given string.
 
Method Summary
 void checkPosition()
          Throws a ParserException if pos is out of range.
 void match(char c)
          Skips the next character in s if it matches c, otherwise a ParserException is thrown.
 String nextQuotedString()
          Returns the next quoted string is s (quotes included).
 String nextToken()
          Returns the next token in s.
 void skipWhiteSpace()
          Skips the next sequence of white space in s.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

public String s
The string being parsed.


pos

public int pos
The index of the next character in s to be parsed.

Constructor Detail

Parser

public Parser(String s)
Creates a new parser on the given string.

Parameters:
s - the string to be parsed
Method Detail

checkPosition

public void checkPosition()
                   throws ParserException
Throws a ParserException if pos is out of range.

Throws:
ParserException

match

public void match(char c)
           throws ParserException
Skips the next character in s if it matches c, otherwise a ParserException is thrown.

Parameters:
c -
Throws:
ParserException

nextQuotedString

public String nextQuotedString()
                        throws ParserException
Returns the next quoted string is s (quotes included). Throws a ParserException if the next substring in s is not a quoted string.

Returns:
the next quoted string in s (quotes included)
Throws:
ParserException

nextToken

public String nextToken()
                 throws ParserException
Returns the next token in s. Throws a ParserException if the next substring in s is not a token.

Returns:
the next token in s
Throws:
ParserException

skipWhiteSpace

public void skipWhiteSpace()
Skips the next sequence of white space in s. An exception is not thrown if there is no matching white space.



Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.