com.sun.jersey.core.header
Class GrammarUtil

java.lang.Object
  extended by com.sun.jersey.core.header.GrammarUtil

public final class GrammarUtil
extends java.lang.Object

Class containing static utility methods to work with HTTP headers.

Author:
Paul Sandoz, Martin Matula

Field Summary
static int COMMENT
          Represents comment type in the TYPE_TABLE
static int CONTROL
          Represents control type in the TYPE_TABLE
static boolean[] IS_TOKEN
          convenience table mapping chars to true if they are tokens
static boolean[] IS_WHITE_SPACE
          Convenience table mapping chars to true if they are white space chars
static int QUOTED_STRING
          Represents quotes type in the TYPE_TABLE
static int SEPARATOR
          Represents separator type in the TYPE_TABLE
static char[] SEPARATORS
          Array of chars representing separators
static int TOKEN
          Represents token type in the TYPE_TABLE
static int[] TYPE_TABLE
          Mapping of chars to types
static char[] WHITE_SPACE
          Array of chars representing white spaces
 
Constructor Summary
GrammarUtil()
           
 
Method Summary
static boolean containsWhiteSpace(java.lang.String s)
          Returns true if string s contains a white space char.
static java.lang.String filterToken(java.lang.String s, int start, int end)
           
static java.lang.String filterToken(java.lang.String s, int start, int end, boolean preserveBackslash)
           
static boolean isToken(char c)
          Returns true if the provided char is a token.
static boolean isTokenString(java.lang.String s)
          Returns true if all chars in string s are tokens.
static boolean isWhiteSpace(char c)
          Returns true if the provided char is a white space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOKEN

public static final int TOKEN
Represents token type in the TYPE_TABLE

See Also:
Constant Field Values

QUOTED_STRING

public static final int QUOTED_STRING
Represents quotes type in the TYPE_TABLE

See Also:
Constant Field Values

COMMENT

public static final int COMMENT
Represents comment type in the TYPE_TABLE

See Also:
Constant Field Values

SEPARATOR

public static final int SEPARATOR
Represents separator type in the TYPE_TABLE

See Also:
Constant Field Values

CONTROL

public static final int CONTROL
Represents control type in the TYPE_TABLE

See Also:
Constant Field Values

WHITE_SPACE

public static final char[] WHITE_SPACE
Array of chars representing white spaces


SEPARATORS

public static final char[] SEPARATORS
Array of chars representing separators


TYPE_TABLE

public static final int[] TYPE_TABLE
Mapping of chars to types


IS_WHITE_SPACE

public static final boolean[] IS_WHITE_SPACE
Convenience table mapping chars to true if they are white space chars


IS_TOKEN

public static final boolean[] IS_TOKEN
convenience table mapping chars to true if they are tokens

Constructor Detail

GrammarUtil

public GrammarUtil()
Method Detail

isWhiteSpace

public static boolean isWhiteSpace(char c)
Returns true if the provided char is a white space.

Parameters:
c - char to check
Returns:
true if c is a white space

isToken

public static boolean isToken(char c)
Returns true if the provided char is a token.

Parameters:
c - char to check
Returns:
true if c is a token

isTokenString

public static boolean isTokenString(java.lang.String s)
Returns true if all chars in string s are tokens.

Parameters:
s - string to check for tokens
Returns:
true if all chars in s are tokens

containsWhiteSpace

public static boolean containsWhiteSpace(java.lang.String s)
Returns true if string s contains a white space char.

Parameters:
s - string to check for white spaces
Returns:
true if s contains white spaces

filterToken

public static java.lang.String filterToken(java.lang.String s,
                                           int start,
                                           int end)

filterToken

public static java.lang.String filterToken(java.lang.String s,
                                           int start,
                                           int end,
                                           boolean preserveBackslash)


Copyright © 2014 Oracle Corporation. All Rights Reserved.