Class Overview
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 prohibted from
the output of the StringPrep processing function.
- Mapping Table: Contains code ponts that are deleted from the output or case mapped.
The procedure for preparing Unicode strings:
- 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.
Summary
Constants |
int |
ALLOW_UNASSIGNED |
Option to allow processing of unassigned code points in the input |
int |
DEFAULT |
Option to prohibit processing of unassigned code points in the input |
Public Constructors |
|
StringPrep(InputStream inputStream)
Creates an StringPrep object after reading the input stream.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Constants
public
static
final
int
ALLOW_UNASSIGNED
Option to allow processing of unassigned code points in the input
Constant Value:
1
(0x00000001)
public
static
final
int
DEFAULT
Option to prohibit processing of unassigned code points in the input
Constant Value:
0
(0x00000000)
Public Constructors
public
StringPrep
(InputStream inputStream)
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 |
Public Methods
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
| A UCharacterIterator object containing the source string |
options
| 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 A StringBuffer containing the output