Top Description Methods
com.ongres.stringprep

public Interface Profile

Imports
java.util.Set

The Profile interface is used to define stringprep profiles in order to fully specify the processing options.

Stringprep profiles can also exclude characters that should not normally appear in text that is used in the protocol. The profile can prevent such characters by changing the characters to be excluded to other characters, by removing those characters, or by causing an error if the characters would appear in the output.

Since
2.0

Method Summary

Modifier and TypeMethod and Description
public default int[]

Returns:

Mapping with the int[] array or with the same codePoint.
additionalMappingTable
(int
the character (Unicode code point) to be mapped.
codePoint
)

Any additional mapping tables specific to the profile.

public default String

Returns:

The prepared String.
prepareQuery
(String
to prepare based on a "stringprep" profile.
string
)

"Queries" are strings that are used to match against strings that are stored identifiers, such as user-entered names for digital certificate authorities and DNS lookups.

public default String

Returns:

The prepared String.
prepareStored
(String
to prepare based on a "stringprep" profile.
string
)

"Stored strings" are strings that are used in protocol identifiers and named entities, such as names in digital certificates and DNS domain name parts.

public Set<Option>

Returns:

profile options.
profile
()

Set of options used by the profile.

public default boolean

Returns:

true if the given codePoint is prohibited on this profile.
prohibitedAdditionalCharacters
(int
the character (Unicode code point) to be tested.
codePoint
)

Any additional characters that are prohibited as output specific to the profile.

Method Detail

additionalMappingTableback to summary
public default int[] additionalMappingTable(int codePoint)

Any additional mapping tables specific to the profile.

Implementation Specification

Profiles that requires additional mapping tables must implement this method. A code point match return the mapped array with the new code points or if there is no match, it should return the same input code point as new int[] {codePoint};. Implementations MUST also set Option#ADDITIONAL_MAPPING to enable the proccesing of this rule.

Implementation Note

The default implementation always return the same code point mapping (new int[] {codePoint}), no change is done to the code point.

Parameters
codePoint:int

the character (Unicode code point) to be mapped.

Returns:int[]

Mapping with the int[] array or with the same codePoint.

prepareQueryback to summary
public default String prepareQuery(String string)

"Queries" are strings that are used to match against strings that are stored identifiers, such as user-entered names for digital certificate authorities and DNS lookups.

Implementation Note

The default method sets the storedStrings Stringprep parameter to false, as "queries" MAY include unassigned code points. This method should not necessarily be overridden by implementations.

Parameters
string:String

to prepare based on a "stringprep" profile.

Returns:String

The prepared String.

Exceptions
IllegalArgumentException:
if there is a prohibited output.
prepareStoredback to summary
public default String prepareStored(String string)

"Stored strings" are strings that are used in protocol identifiers and named entities, such as names in digital certificates and DNS domain name parts.

Implementation Note

The default method sets the storedStrings Stringprep parameter to true, as "stored strings" MUST NOT contain unassigned code points. This method should not necessarily be overridden by implementations.

Parameters
string:String

to prepare based on a "stringprep" profile.

Returns:String

The prepared String.

Exceptions
IllegalArgumentException:
if there is a prohibited output.
profileback to summary
public Set<Option> profile()

Set of options used by the profile.

Returns:Set<Option>

profile options.

prohibitedAdditionalCharactersback to summary
public default boolean prohibitedAdditionalCharacters(int codePoint)

Any additional characters that are prohibited as output specific to the profile.

Implementation Specification

Profiles that prohibit additional characters must implement this method. A code point match return true, or if the code point should not be prohibited it should return false. Implementations MUST also set Option#FORBID_ADDITIONAL_CHARACTERS to enable the proccesing of this rule.

Implementation Note

The default implementation always return false, all characters are accepted.

Parameters
codePoint:int

the character (Unicode code point) to be tested.

Returns:boolean

true if the given codePoint is prohibited on this profile.