Top Description Fields Constructors Methods
com.ongres.stringprep

public final Class Stringprep

extends Object
Class Inheritance
Imports
java.text.Normalizer, java.util.EnumSet, .Iterator, .Objects, .ServiceLoader

Java implementation of StringPrep (RFC 3454).
Version
2.0
See Also
RFC 3454

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final boolean
private final Profile

Constructor Summary

AccessConstructor and Description
pack-priv
Stringprep(Profile
includes the options to implement a Stringprep profile.
profile
,
boolean
"stored strings" MUST NOT contain unassigned code points, "queries" MAY include them.
storedStrings
)

Create a Stringprep instance based on a Profile Options and the two different types of strings in typical protocols where internationalized strings are used: "stored strings" and "queries".

Method Summary

Modifier and TypeMethod and Description
public static Profile

Returns:

Profile if there is a provider match.
getProvider
(String
name of the profile to lookup from the ServiceLoader.
profileName
)

Lookup the provider service that contains the profile.

private String
map(String string)

pack-priv String

Returns:

The prepared string following the options of the profile.
prepare
(String
to prepare.
string
)

Preparation of Internationalized Strings.

private static IllegalArgumentException
private void
prohibitedOutput(int codePoint)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

additionalMappingback to summary
private final boolean additionalMapping
caseFoldNfkcback to summary
private final boolean caseFoldNfkc
caseFoldNoNormalizationback to summary
private final boolean caseFoldNoNormalization
checkBidiback to summary
private final boolean checkBidi
forbidAdditionalCharactersback to summary
private final boolean forbidAdditionalCharacters
forbidAsciiControlback to summary
private final boolean forbidAsciiControl
forbidAsciiSpacesback to summary
private final boolean forbidAsciiSpaces
forbidChangeDisplayDeprecatedback to summary
private final boolean forbidChangeDisplayDeprecated
forbidInappropriateCanonRepback to summary
private final boolean forbidInappropriateCanonRep
forbidInappropriatePlainTextback to summary
private final boolean forbidInappropriatePlainText
forbidNonAsciiControlback to summary
private final boolean forbidNonAsciiControl
forbidNonAsciiSpacesback to summary
private final boolean forbidNonAsciiSpaces
forbidNonCharacterback to summary
private final boolean forbidNonCharacter
forbidPrivateUseback to summary
private final boolean forbidPrivateUse
forbidSurrogateback to summary
private final boolean forbidSurrogate
forbidTaggingback to summary
private final boolean forbidTagging
forbidUnassignedback to summary
private final boolean forbidUnassigned
mapToNothingback to summary
private final boolean mapToNothing
normalizeKcback to summary
private final boolean normalizeKc
profileback to summary
private final Profile profile

Constructor Detail

Stringprepback to summary
pack-priv Stringprep(Profile profile, boolean storedStrings)

Create a Stringprep instance based on a Profile Options and the two different types of strings in typical protocols where internationalized strings are used: "stored strings" and "queries".

Parameters
profile:Profile

includes the options to implement a Stringprep profile.

storedStrings:boolean

"stored strings" MUST NOT contain unassigned code points, "queries" MAY include them.

Exceptions
NullPointerException:
if profile is null.

Method Detail

getProviderback to summary
public static Profile getProvider(String profileName)

Lookup the provider service that contains the profile.

Parameters
profileName:String

name of the profile to lookup from the ServiceLoader.

Returns:Profile

Profile if there is a provider match.

Exceptions
IllegalArgumentException:
if no provider is found.
NullPointerException:
if profileName is null.
mapback to summary
private String map(String string)
prepareback to summary
pack-priv String prepare(String string)

Preparation of Internationalized Strings.

The steps for preparing strings are:

  1. 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.
  2. Normalize -- Possibly normalize the result of step 1 using Unicode normalization. This is described in section 4.
  3. 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.
  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. This is described in section 6.
Parameters
string:String

to prepare.

Returns:String

The prepared string following the options of the profile.

Exceptions
IllegalArgumentException:
if there are prohibited or bidi characters depending on the profile used.
NullPointerException:
if string is null.
prohibitedCharaterback to summary
private static IllegalArgumentException prohibitedCharater(String msg, int cp)
prohibitedOutputback to summary
private void prohibitedOutput(int codePoint)