Package com.ibm.icu.text
Class StringPrep
java.lang.Object
com.ibm.icu.text.StringPrep
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
- Unassigned Table: Contains code points that are unassigned in the Unicode Version supported by StringPrep. Currently RFC 3454 supports Unicode 3.2.
- Prohibited Table: Contains code points that are prohibited from the output of the StringPrep processing function.
- Mapping Table: Contains code points that are deleted from the output or case mapped.
- Map: For each character in the input, check if it has a mapping and, if so, replace it with its mapping.
- Normalize: Possibly normalize the result of step 1 using Unicode normalization.
- Prohibit: Check for any characters that are not allowed in the output. If any are found, return an error.
- 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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Option to allow processing of unassigned code points in the inputstatic final int
Option to prohibit processing of unassigned code points in the inputstatic final int
Profile type: RFC3491 Nameprepstatic final int
Profile type: RFC3530 nfs4_cis_prepstatic final int
Profile type: RFC3530 nfs4_cs_prepstatic final int
Profile type: RFC3530 nfs4_cs_prep with case insensitive optionstatic final int
Profile type: RFC3530 nfs4_mixed_prep for prefixstatic final int
Profile type: RFC3530 nfs4_mixed_prep for suffixstatic final int
Profile type: RFC3722 iSCSIstatic final int
Profile type: RFC3920 XMPP Nodeprepstatic final int
Profile type: RFC3920 XMPP Resourceprepstatic final int
Profile type: RFC4011 Policy MIB Stringprepstatic final int
Profile type: RFC4013 SASLprepstatic final int
Profile type: RFC4505 tracestatic final int
Profile type: RFC4518 LDAPstatic final int
Profile type: RFC4518 LDAP for case ignore, numeric and stored prefix matching rules -
Constructor Summary
ConstructorsConstructorDescriptionStringPrep
(InputStream inputStream) Creates an StringPrep object after reading the input stream. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringPrep
getInstance
(int profile) Gets a StringPrep instance for the specified profileprepare
(UCharacterIterator src, int options) Prepare the input buffer for use in applications with the given profile.Prepare the input String for use in applications with the given profile.
-
Field Details
-
DEFAULT
public static final int DEFAULTOption to prohibit processing of unassigned code points in the input- See Also:
-
ALLOW_UNASSIGNED
public static final int ALLOW_UNASSIGNEDOption to allow processing of unassigned code points in the input- See Also:
-
RFC3491_NAMEPREP
public static final int RFC3491_NAMEPREPProfile type: RFC3491 Nameprep- See Also:
-
RFC3530_NFS4_CS_PREP
public static final int RFC3530_NFS4_CS_PREPProfile type: RFC3530 nfs4_cs_prep- See Also:
-
RFC3530_NFS4_CS_PREP_CI
public static final int RFC3530_NFS4_CS_PREP_CIProfile type: RFC3530 nfs4_cs_prep with case insensitive option- See Also:
-
RFC3530_NFS4_CIS_PREP
public static final int RFC3530_NFS4_CIS_PREPProfile type: RFC3530 nfs4_cis_prep- See Also:
-
RFC3530_NFS4_MIXED_PREP_PREFIX
public static final int RFC3530_NFS4_MIXED_PREP_PREFIXProfile type: RFC3530 nfs4_mixed_prep for prefix- See Also:
-
RFC3530_NFS4_MIXED_PREP_SUFFIX
public static final int RFC3530_NFS4_MIXED_PREP_SUFFIXProfile type: RFC3530 nfs4_mixed_prep for suffix- See Also:
-
RFC3722_ISCSI
public static final int RFC3722_ISCSIProfile type: RFC3722 iSCSI- See Also:
-
RFC3920_NODEPREP
public static final int RFC3920_NODEPREPProfile type: RFC3920 XMPP Nodeprep- See Also:
-
RFC3920_RESOURCEPREP
public static final int RFC3920_RESOURCEPREPProfile type: RFC3920 XMPP Resourceprep- See Also:
-
RFC4011_MIB
public static final int RFC4011_MIBProfile type: RFC4011 Policy MIB Stringprep- See Also:
-
RFC4013_SASLPREP
public static final int RFC4013_SASLPREPProfile type: RFC4013 SASLprep- See Also:
-
RFC4505_TRACE
public static final int RFC4505_TRACEProfile type: RFC4505 trace- See Also:
-
RFC4518_LDAP
public static final int RFC4518_LDAPProfile type: RFC4518 LDAP- See Also:
-
RFC4518_LDAP_CI
public static final int RFC4518_LDAP_CIProfile type: RFC4518 LDAP for case ignore, numeric and stored prefix matching rules- See Also:
-
-
Constructor Details
-
StringPrep
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
- An exception occurs when I/O of the inputstream is invalid
-
-
Method Details
-
getInstance
Gets a StringPrep instance for the specified profile- Parameters:
profile
- The profile passed to find the StringPrep instance.
-
prepare
Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC), checks for prohibited 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 stringoptions
- A bit set of options:DEFAULT
Prohibit processing of unassigned code points in the inputALLOW_UNASSIGNED
Treat the unassigned code points are in the input as normal Unicode code points.
- Returns:
- StringBuffer A StringBuffer containing the output
- Throws:
StringPrepParseException
- An exception occurs when parsing a string is invalid.
-
prepare
Prepare the input String for use in applications with the given profile. This operation maps, normalizes(NFKC), checks for prohibited and BiDi characters in the order defined by RFC 3454 depending on the options specified in the profile.- Parameters:
src
- A stringoptions
- A bit set of options:DEFAULT
Prohibit processing of unassigned code points in the inputALLOW_UNASSIGNED
Treat the unassigned code points are in the input as normal Unicode code points.
- Returns:
- String A String containing the output
- Throws:
StringPrepParseException
- An exception when parsing or preparing a string is invalid.
-