com.ibm.icu.text

Class StringPrep

public final class StringPrep extends Object

StringPrep API implements the StingPrep framework as described by RFC 3454. StringPrep prepares Unicode strings for use in network protocols. Profiles of StingPrep are set of rules and data according to which the Unicode Strings are prepared. Each profiles contains tables which describe how a code point should be treated. The tables are broadly classied into The procedure for preparing Unicode strings:
  1. Map: For each character in the input, check if it has a mapping and, if so, replace it with its mapping.
  2. Normalize: Possibly normalize the result of step 1 using Unicode normalization.
  3. Prohibit: Check for any characters that are not allowed in the output. If any are found, return an error.
  4. Check bidi: Possibly check for right-to-left characters, and if any are found, make sure that the whole string satisfies the requirements for bidirectional strings. If the string does not satisfy the requirements for bidirectional strings, return an error.

Author: Ram Viswanadha

UNKNOWN: ICU 2.8

Field Summary
static intALLOW_UNASSIGNED
Option to allow processing of unassigned code points in the input
static intDEFAULT
Option to prohibit processing of unassigned code points in the input
Constructor Summary
StringPrep(InputStream inputStream)
Creates an StringPrep object after reading the input stream.
Method Summary
StringBufferprepare(UCharacterIterator src, int options)
Prepare the input buffer for use in applications with the given profile.

Field Detail

ALLOW_UNASSIGNED

public static final int ALLOW_UNASSIGNED
Option to allow processing of unassigned code points in the input

See Also: StringPrep

UNKNOWN: ICU 2.8

DEFAULT

public static final int DEFAULT
Option to prohibit processing of unassigned code points in the input

See Also: StringPrep

UNKNOWN: ICU 2.8

Constructor Detail

StringPrep

public StringPrep(InputStream inputStream)
Creates an StringPrep object after reading the input stream. The object does not hold a reference to the input steam, so the stream can be closed after the method returns.

Parameters: inputStream The stream for reading the StringPrep profile binarySun

Throws: IOException

UNKNOWN: ICU 2.8

Method Detail

prepare

public StringBuffer prepare(UCharacterIterator src, int options)
Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC), checks for prohited and BiDi characters in the order defined by RFC 3454 depending on the options specified in the profile.

Parameters: src A UCharacterIterator object containing the source string options A bit set of options: - StringPrep.NONE Prohibit processing of unassigned code points in the input - StringPrep.ALLOW_UNASSIGNED Treat the unassigned code points are in the input as normal Unicode code points.

Returns: StringBuffer A StringBuffer containing the output

Throws: ParseException

UNKNOWN: ICU 2.8