com.ibm.icu.text
Class HexToUnicodeTransliterator

java.lang.Object
  |
  +--com.ibm.icu.text.Transliterator
        |
        +--com.ibm.icu.text.HexToUnicodeTransliterator

public class HexToUnicodeTransliterator
extends Transliterator

A transliterator that converts from hexadecimal Unicode escape sequences to the characters they represent. For example, "U+0040" and '@'. A default HexToUnicodeTransliterator recognizes the prefixes "U+", "u+", "\U", and "\u". Hex values may be upper- or lowercase. By calling the applyPattern() method, one or more custom prefix/suffix pairs may be specified. See applyPattern() for details.

Version:
$RCSfile: HexToUnicodeTransliterator.java,v $ $Revision: 1.13 $ $Date: 2002/02/25 22:43:58 $
Author:
Alan Liu

Inner classes inherited from class com.ibm.icu.text.Transliterator
Transliterator.Factory, Transliterator.Position
 
Fields inherited from class com.ibm.icu.text.Transliterator
FORWARD, ID_DELIM, ID_SEP, REVERSE, VARIANT_SEP
 
Constructor Summary
HexToUnicodeTransliterator()
          Constructs a transliterator.
HexToUnicodeTransliterator(java.lang.String thePattern)
          Constructs a transliterator.
HexToUnicodeTransliterator(java.lang.String thePattern, UnicodeFilter theFilter)
          Constructs a transliterator.
 
Method Summary
 void applyPattern(java.lang.String pattern)
          Set the patterns recognized by this transliterator.
protected  void handleTransliterate(Replaceable text, Transliterator.Position offsets, boolean isIncremental)
          Implements Transliterator.handleTransliterate(com.ibm.icu.text.Replaceable, com.ibm.icu.text.Transliterator.Position, boolean).
 java.lang.String toPattern()
          Return this transliterator's pattern.
 
Methods inherited from class com.ibm.icu.text.Transliterator
baseToRules, createFromRules, filteredCharAt, filteredTransliterate, finishTransliteration, getAvailableIDs, getAvailableSources, getAvailableTargets, getAvailableVariants, getDisplayName, getDisplayName, getFilter, getID, getInstance, getInstance, getInverse, getMaximumContextLength, registerClass, registerFactory, setFilter, setID, setMaximumContextLength, toRules, transliterate, transliterate, transliterate, transliterate, transliterate, transliterate, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HexToUnicodeTransliterator

public HexToUnicodeTransliterator()
Constructs a transliterator.

HexToUnicodeTransliterator

public HexToUnicodeTransliterator(java.lang.String thePattern)
Constructs a transliterator.

HexToUnicodeTransliterator

public HexToUnicodeTransliterator(java.lang.String thePattern,
                                  UnicodeFilter theFilter)
Constructs a transliterator.
Method Detail

applyPattern

public void applyPattern(java.lang.String pattern)
Set the patterns recognized by this transliterator. One or more patterns may be specified, separated by semicolons (';'). Each pattern contains zero or more prefix characters, one or more digit characters, and zero or more suffix characters. The digit characters indicates optional digits ('#') followed by required digits ('0'). The total number of digits cannot exceed 4, and must be at least 1 required digit. Use a backslash ('\\') to escape any of the special characters. An empty pattern is allowed; it specifies a transliterator that does nothing.

Example: "U+0000;<###0>" specifies two patterns. The first has a prefix of "U+", exactly four digits, and no suffix. The second has a prefix of "<", between one and four digits, and a suffix of ">".

 pattern := spec | ( pattern ';' spec )
 spec := prefix-char* digit-spec suffix-char*
 digit-spec := '#'* '0'+
 prefix-char := [^special-char] | '\\' special-char
 suffix-char := [^special-char] | '\\' special-char
 special-char := ';' | '0' | '#' | '\\'
 

toPattern

public java.lang.String toPattern()
Return this transliterator's pattern.

handleTransliterate

protected void handleTransliterate(Replaceable text,
                                   Transliterator.Position offsets,
                                   boolean isIncremental)
Implements Transliterator.handleTransliterate(com.ibm.icu.text.Replaceable, com.ibm.icu.text.Transliterator.Position, boolean).
Overrides:
handleTransliterate in class Transliterator
Following copied from class: com.ibm.icu.text.Transliterator
Parameters:
text - the buffer holding transliterated and untransliterated text
pos - the start and limit of the text, the position of the cursor, and the start and limit of transliteration.
incremental - if true, assume more text may be coming after pos.contextLimit. Otherwise, assume the text is complete.
See Also:
Transliterator.transliterate(com.ibm.icu.text.Replaceable, int, int)


Copyright (c) 2001 IBM Corporation and others.