org.apache.vysper.xmpp.addressing.stringprep
Class StringPrep

java.lang.Object
  extended by org.apache.vysper.xmpp.addressing.stringprep.StringPrep
Direct Known Subclasses:
NodePrep, ResourcePrep

@SpecCompliant(spec="RFC3454")
public class StringPrep
extends java.lang.Object

Use this class to prepare a String according to the Stringprep profile. The methods buildMapping() and buildProhibitedSet() can be overridden to modify the behavior of the Stringprep check. see http://www.ietf.org/rfc/rfc3454.txt

Author:
Gerolf Seitz (gseitz@apache.org)

Constructor Summary
StringPrep()
          Construct.
 
Method Summary
protected  java.util.Map<java.lang.String,java.lang.String> buildMapping()
          Override this method and return a custom map of character mappings to alter the Stringprep behavior.
protected  java.util.Set<java.lang.String> buildProhibitedSet()
          Override this method and return a custom set of prohibited characters to alter the Stringprep behavior.
 java.lang.String prepareString(java.lang.String str)
          Prepares the given String according to the Stringprep specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPrep

public StringPrep()
Construct.

Method Detail

prepareString

public java.lang.String prepareString(java.lang.String str)
                               throws StringPrepViolationException
Prepares the given String according to the Stringprep specification.

Parameters:
str - the string to prepare
Returns:
the prepared String
Throws:
StringPrepViolationException - in case the String cannot be prepared

buildMapping

protected java.util.Map<java.lang.String,java.lang.String> buildMapping()
Override this method and return a custom map of character mappings to alter the Stringprep behavior.

Returns:
a Map containing all character mappings

buildProhibitedSet

protected java.util.Set<java.lang.String> buildProhibitedSet()
Override this method and return a custom set of prohibited characters to alter the Stringprep behavior.

Returns:
a Set containing all characters that are prohibited