com.noelios.restlet.util
Class HeaderReader

java.lang.Object
  extended by com.noelios.restlet.util.HeaderReader
Direct Known Subclasses:
CookieReader, PreferenceReader

public class HeaderReader
extends Object

HTTP-style header reader.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
HeaderReader(String header)
          Constructor.
 
Method Summary
protected  void appendQuotedString(Appendable buffer)
          Appends the next quoted string.
protected  boolean isLinearWhiteSpace(int character)
          Indicates if the given character is a value separator.
protected  boolean isValueSeparator(int character)
          Indicates if the given character is a value separator.
 int read()
          Reads the next character.
protected  String readQuotedString()
          Reads the next quoted string.
 String readValue()
          Read the next value of a multi-value header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeaderReader

public HeaderReader(String header)
Constructor.

Parameters:
header - The header to read.
Method Detail

read

public int read()
Reads the next character.

Returns:
The next character.

readValue

public String readValue()
Read the next value of a multi-value header. It skips separator commas and spaces.

Returns:
The next value or null.
See Also:
HTTP parsing rule

isValueSeparator

protected boolean isValueSeparator(int character)
Indicates if the given character is a value separator.

Parameters:
character - The character to test.
Returns:
True if the given character is a value separator.

isLinearWhiteSpace

protected boolean isLinearWhiteSpace(int character)
Indicates if the given character is a value separator.

Parameters:
character - The character to test.
Returns:
True if the given character is a value separator.

readQuotedString

protected String readQuotedString()
                           throws IOException
Reads the next quoted string.

Returns:
The next quoted string.
Throws:
IOException

appendQuotedString

protected void appendQuotedString(Appendable buffer)
                           throws IOException
Appends the next quoted string.

Parameters:
buffer - The buffer to append.
Throws:
IOException


Copyright © 2005-2007 Noelios Technologies.