Class Stringprep
java.lang.Object
com.ongres.stringprep.Stringprep
Java implementation of StringPrep (RFC 3454).
- Version:
- 2.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final Profile -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckProhibited(boolean forbid, IntPredicate tableCheck, int codePoint, String msg) static ProfilegetProvider(String profileName) Lookup the provider service that contains the profile.private char[]map(char[] string) (package private) char[]prepare(char[] string) Preparation of Internationalized Strings.private voidprohibitedOutput(int codePoint)
-
Field Details
-
profile
-
mapToNothing
private final boolean mapToNothing -
additionalMapping
private final boolean additionalMapping -
caseFoldNfkc
private final boolean caseFoldNfkc -
caseFoldNoNormalization
private final boolean caseFoldNoNormalization -
normalizeKc
private final boolean normalizeKc -
checkBidi
private final boolean checkBidi -
forbidAdditionalCharacters
private final boolean forbidAdditionalCharacters -
forbidAsciiSpaces
private final boolean forbidAsciiSpaces -
forbidNonAsciiSpaces
private final boolean forbidNonAsciiSpaces -
forbidAsciiControl
private final boolean forbidAsciiControl -
forbidNonAsciiControl
private final boolean forbidNonAsciiControl -
forbidPrivateUse
private final boolean forbidPrivateUse -
forbidNonCharacter
private final boolean forbidNonCharacter -
forbidSurrogate
private final boolean forbidSurrogate -
forbidInappropriatePlainText
private final boolean forbidInappropriatePlainText -
forbidInappropriateCanonRep
private final boolean forbidInappropriateCanonRep -
forbidChangeDisplayDeprecated
private final boolean forbidChangeDisplayDeprecated -
forbidTagging
private final boolean forbidTagging -
forbidUnassigned
private final boolean forbidUnassigned
-
-
Constructor Details
-
Stringprep
Stringprep(Profile profile, boolean storedStrings) Create a Stringprep instance based on aProfileOptions and the two different types of strings in typical protocols where internationalized strings are used: "stored strings" and "queries".- Parameters:
profile- includes the options to implement a Stringprep profile.storedStrings- "stored strings" MUST NOT contain unassigned code points, "queries" MAY include them.- Throws:
NullPointerException- ifprofileisnull.
-
-
Method Details
-
getProvider
Lookup the provider service that contains the profile.- Parameters:
profileName- name of the profile to lookup from the ServiceLoader.- Returns:
- Profile if there is a provider match.
- Throws:
IllegalArgumentException- if no provider is found.NullPointerException- ifprofileNameisnull.
-
prepare
char[] prepare(char[] string) Preparation of Internationalized Strings.The steps for preparing strings are:
- Map -- For each character in the input, check if it has a mapping and, if so, replace it with its mapping. This is described in section 3.
- Normalize -- Possibly normalize the result of step 1 using Unicode normalization. This is described in section 4.
- Prohibit -- Check for any characters that are not allowed in the output. If any are found, return an error. This is described in section 5.
- 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. This is described in section 6.
- Parameters:
string- to prepare.- Returns:
- The prepared string following the options of the profile.
- Throws:
IllegalArgumentException- if there are prohibited or bidi characters depending on the profile used.NullPointerException- ifstringisnull.
-
map
private char[] map(char[] string) -
prohibitedOutput
private void prohibitedOutput(int codePoint) -
checkProhibited
private static void checkProhibited(boolean forbid, IntPredicate tableCheck, int codePoint, String msg)
-