org.apache.mina.proxy.utils
Class StringUtilities

java.lang.Object
  extended by org.apache.mina.proxy.utils.StringUtilities

public class StringUtilities
extends Object

StringUtilities.java - Various methods to handle strings.

Since:
MINA 2.0.0-M3
Version:
$Rev: 686486 $, $Date: 2008-08-16 14:46:10 +0200 (Sa, 16 Aug 2008) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Constructor Summary
StringUtilities()
           
 
Method Summary
static void addValueToHeader(Map<String,List<String>> headers, String key, String value, boolean singleValued)
           
static String copyDirective(HashMap<String,String> src, HashMap<String,String> dst, String directive)
          Copy the directive to the from src to dst if not null.
static String copyDirective(HashMap<String,String> directives, StringBuilder sb, String directive)
          Copy the directive to the StringBuilder if not null.
static String getDirectiveValue(HashMap<String,String> directivesMap, String directive, boolean mandatory)
          Returns the value of a directive from the map.
static String getSingleValuedHeader(Map<String,List<String>> headers, String key)
           
static boolean isLws(byte b)
          Is character a linear white space ?
static HashMap<String,String> parseDirectives(byte[] buf)
          Parses digest-challenge string, extracting each token and value(s)
static String stringTo8859_1(String str)
          Used to convert username-value, passwd or realm to 8859_1 encoding if all chars in string are within the 8859_1 (Latin 1) encoding range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtilities

public StringUtilities()
Method Detail

getDirectiveValue

public static String getDirectiveValue(HashMap<String,String> directivesMap,
                                       String directive,
                                       boolean mandatory)
                                throws AuthenticationException
Returns the value of a directive from the map. If mandatory is true and the value is null, then it throws a AuthenticationException.

Throws:
AuthenticationException

copyDirective

public static String copyDirective(HashMap<String,String> directives,
                                   StringBuilder sb,
                                   String directive)
Copy the directive to the StringBuilder if not null.


copyDirective

public static String copyDirective(HashMap<String,String> src,
                                   HashMap<String,String> dst,
                                   String directive)
Copy the directive to the from src to dst if not null.


parseDirectives

public static HashMap<String,String> parseDirectives(byte[] buf)
                                              throws SaslException
Parses digest-challenge string, extracting each token and value(s)

Parameters:
buf - A non-null digest-challenge string.
Throws:
UnsupportedEncodingException
SaslException - if the String cannot be parsed according to RFC 2831

isLws

public static boolean isLws(byte b)
Is character a linear white space ? LWS = [CRLF] 1*( SP | HT ) Note that we're checking individual bytes instead of CRLF

Parameters:
b - the byte to check
Returns:
true if it's a linear white space

stringTo8859_1

public static String stringTo8859_1(String str)
                             throws UnsupportedEncodingException
Used to convert username-value, passwd or realm to 8859_1 encoding if all chars in string are within the 8859_1 (Latin 1) encoding range.

Parameters:
str - a non-null String
Returns:
a non-null String containing the 8859_1 encoded string
Throws:
AuthenticationException
UnsupportedEncodingException

getSingleValuedHeader

public static String getSingleValuedHeader(Map<String,List<String>> headers,
                                           String key)

addValueToHeader

public static void addValueToHeader(Map<String,List<String>> headers,
                                    String key,
                                    String value,
                                    boolean singleValued)


Copyright © 2004-2010 Apache MINA Project. All Rights Reserved.