APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.icu.text

public final Class StringPrep

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .ByteArrayInputStream, .IOException, .InputStream, java.text.ParseException, sun.text.Normalizer, jdk.internal.icu.impl.CharTrie, .StringPrepDataReader, .Trie, jdk.internal.icu.lang.UCharacter, .UCharacterDirection, jdk.internal.icu.util.VersionInfo

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
ICU Status
Draft since ICU 2.8.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
public static final int
ALLOW_UNASSIGNED

Option to allow processing of unassigned code points in the input

private static final int
private boolean
private static final int
DATA_BUFFER_SIZE

Default buffer size of datafile

public static final int
DEFAULT

Option to prohibit processing of unassigned code points in the input

private static final int
private boolean
private byte[]
private static final int
private static final int
private static final int
private static final int
private int[]
private static final int
private char[]
private static final int
private static final int
private static final int
private static final int
private VersionInfo
private static final int
private static final int
private static final int
private StringPrep.StringPrepTrieImpl
private VersionInfo
private static final int
private static final int
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
StringPrep(InputStream
The stream for reading the StringPrep profile binarySun
inputStream
)

Creates an StringPrep object after reading the input stream.

Method Summary

Modifier and TypeMethod and Description
private char
private static final void
getValues(char trieWord, StringPrep.Values values)

private static VersionInfo
getVersionInfo(int comp)

private static VersionInfo
getVersionInfo(byte[] version)

private StringBuffer
map(UCharacterIterator iter, int options)

private StringBuffer
public StringBuffer

Returns:

StringBuffer A StringBuffer containing the output
prepare
(UCharacterIterator
A UCharacterIterator object containing the source string
src
,
int
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.
options
)

Prepare the input buffer for use in applications with the given profile.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOW_UNASSIGNEDback to summary
public static final int ALLOW_UNASSIGNED

Option to allow processing of unassigned code points in the input

ICU Status
Draft since ICU 2.8.
See Also
prepare
CHECK_BIDI_ONback to summary
private static final int CHECK_BIDI_ON
checkBiDiback to summary
private boolean checkBiDi
DATA_BUFFER_SIZEback to summary
private static final int DATA_BUFFER_SIZE

Default buffer size of datafile

DEFAULTback to summary
public static final int DEFAULT

Option to prohibit processing of unassigned code points in the input

ICU Status
Draft since ICU 2.8.
See Also
prepare
DELETEback to summary
private static final int DELETE
doNFKCback to summary
private boolean doNFKC
formatVersionback to summary
private byte[] formatVersion
FOUR_UCHARS_MAPPING_INDEX_STARTback to summary
private static final int FOUR_UCHARS_MAPPING_INDEX_START
INDEX_MAPPING_DATA_SIZEback to summary
private static final int INDEX_MAPPING_DATA_SIZE
INDEX_TOPback to summary
private static final int INDEX_TOP
INDEX_TRIE_SIZEback to summary
private static final int INDEX_TRIE_SIZE
indexesback to summary
private int[] indexes
MAPback to summary
private static final int MAP
mappingDataback to summary
private char[] mappingData
MAX_INDEX_TOP_LENGTHback to summary
private static final int MAX_INDEX_TOP_LENGTH
MAX_INDEX_VALUEback to summary
private static final int MAX_INDEX_VALUE
NORM_CORRECTNS_LAST_UNI_VERSIONback to summary
private static final int NORM_CORRECTNS_LAST_UNI_VERSION
NORMALIZATION_ONback to summary
private static final int NORMALIZATION_ON
normCorrVerback to summary
private VersionInfo normCorrVer
ONE_UCHAR_MAPPING_INDEX_STARTback to summary
private static final int ONE_UCHAR_MAPPING_INDEX_START
OPTIONSback to summary
private static final int OPTIONS
PROHIBITEDback to summary
private static final int PROHIBITED
sprepTrieImplback to summary
private StringPrep.StringPrepTrieImpl sprepTrieImpl
sprepUniVerback to summary
private VersionInfo sprepUniVer
THREE_UCHARS_MAPPING_INDEX_STARTback to summary
private static final int THREE_UCHARS_MAPPING_INDEX_START
TWO_UCHARS_MAPPING_INDEX_STARTback to summary
private static final int TWO_UCHARS_MAPPING_INDEX_START
TYPE_LIMITback to summary
private static final int TYPE_LIMIT
TYPE_THRESHOLDback to summary
private static final int TYPE_THRESHOLD
UNASSIGNEDback to summary
private static final int UNASSIGNED

Constructor Detail

StringPrepback to summary
public StringPrep(InputStream inputStream) throws IOException

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:InputStream

The stream for reading the StringPrep profile binarySun

ICU Status
Draft since ICU 2.8.

Method Detail

getCodePointValueback to summary
private char getCodePointValue(int ch)
getValuesback to summary
private static final void getValues(char trieWord, StringPrep.Values values)
getVersionInfoback to summary
private static VersionInfo getVersionInfo(int comp)
getVersionInfoback to summary
private static VersionInfo getVersionInfo(byte[] version)
mapback to summary
private StringBuffer map(UCharacterIterator iter, int options) throws ParseException
normalizeback to summary
private StringBuffer normalize(StringBuffer src)
prepareback to summary
public StringBuffer prepare(UCharacterIterator src, int options) throws ParseException

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:UCharacterIterator

A UCharacterIterator object containing the source string

options:int

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

StringBuffer A StringBuffer containing the output

ICU Status
Draft since ICU 2.8.
jdk.internal.icu.text back to summary

private final Class StringPrep.StringPrepTrieImpl

extends Object
implements DataManipulate
Class Inheritance
All Implemented Interfaces
jdk.internal.icu.impl.Trie.DataManipulate

Field Summary

Modifier and TypeField and Description
private CharTrie

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

data offset or 0 if there is no data for the lead surrogate
getFoldingOffset
(int value)

Implements jdk.internal.icu.impl.Trie.DataManipulate.getFoldingOffset.

Called by com.ibm.icu.util.Trie to extract from a lead surrogate's data the index array offset of the indexes for that lead surrogate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sprepTrieback to summary
private CharTrie sprepTrie

Constructor Detail

StringPrepTrieImplback to summary
private StringPrepTrieImpl()

Method Detail

getFoldingOffsetback to summary
public int getFoldingOffset(int value)

Implements jdk.internal.icu.impl.Trie.DataManipulate.getFoldingOffset.

Called by com.ibm.icu.util.Trie to extract from a lead surrogate's data the index array offset of the indexes for that lead surrogate.

Returns:int

data offset or 0 if there is no data for the lead surrogate

jdk.internal.icu.text back to summary

private final Class StringPrep.Values

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isIndexback to summary
pack-priv boolean isIndex
typeback to summary
pack-priv int type
valueback to summary
pack-priv int value

Constructor Detail

Valuesback to summary
private Values()

Method Detail

resetback to summary
public void reset()