Some escape forms actually have two different patterns, one for BMP characters (0..FFFF) and one for supplements (>FFFF). To handle this, a second EscapeTransliterator may be defined that specifies the pattern to be produced for supplementals. An example of a form that requires this is the C form, which uses "\\uFFFF" for BMP characters and "\\U0010FFFF" for supplementals.
This class is package private. It registers several standard variants with the system which are then accessed via their IDs.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | grokSupplementals
If true, supplementals are handled as 32-bit code points. |
| private int | minDigits
The minimum number of digits. |
| private String | prefix
The prefix of the escape form; may be empty, but usually isn't. |
| private int | radix
The radix to display the number in. Typically 16 or 10. |
| private String | suffix
The prefix of the escape form; often empty. |
| private EscapeTransliterator | supplementalHandler
The form to be used for supplementals. |
| Access | Constructor and Description |
|---|---|
| pack-priv | EscapeTransliterator(String ID, String prefix, String suffix, int radix, int minDigits, boolean grokSupplementals, EscapeTransliterator supplementalHandler)
Constructs an escape transliterator with the given ID and parameters. |
| Modifier and Type | Method and Description |
|---|---|
| public void | addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet
TODO targetSet)Overrides com. |
| protected void | handleTransliterate(Replaceable
the buffer holding transliterated and
untransliterated text text, Transliterator.the indices indicating the start, limit, context
start, and context limit of the text. pos,if true, assume more text may be inserted at
incremental)pos.limit and act accordingly. Otherwise,
transliterate all text between pos.start and
pos.limit and move pos.start up to
pos.limit.Implements abstract com. Transliterator#handleTransliterate.
|
| pack-priv static void |
| grokSupplementals | back to summary |
|---|---|
| private boolean grokSupplementals If true, supplementals are handled as 32-bit code points. If false, they are handled as two 16-bit code units. | |
| minDigits | back to summary |
|---|---|
| private int minDigits The minimum number of digits. Typically 1, 4, or 8. Values less than 1 are equivalent to 1. | |
| prefix | back to summary |
|---|---|
| private String prefix The prefix of the escape form; may be empty, but usually isn't. May not be null. | |
| radix | back to summary |
|---|---|
| private int radix The radix to display the number in. Typically 16 or 10. Must be in the range 2 to 36. | |
| suffix | back to summary |
|---|---|
| private String suffix The prefix of the escape form; often empty. May not be null. | |
| supplementalHandler | back to summary |
|---|---|
| private EscapeTransliterator supplementalHandler The form to be used for supplementals. If this is null then the same form is used for BMP characters and supplementals. If this is not null and if grokSupplementals is true then the prefix, suffix, radix, and minDigits of this object are used for supplementals. | |
| EscapeTransliterator | back to summary |
|---|---|
| pack-priv EscapeTransliterator(String ID, String prefix, String suffix, int radix, int minDigits, boolean grokSupplementals, EscapeTransliterator supplementalHandler) Constructs an escape transliterator with the given ID and parameters. See the class member documentation for details. | |
| addSourceTargetSet | back to summary |
|---|---|
| public void addSourceTargetSet(UnicodeSet inputFilter, UnicodeSet sourceSet, UnicodeSet targetSet) Overrides com. Doc from com. Returns the set of all characters that may be generated as replacement text by this transliterator, filtered by BOTH the input filter, and the current getFilter(). SHOULD BE OVERRIDDEN BY SUBCLASSES. It is probably an error for any transliterator to NOT override this, but we can't force them to for backwards compatibility. Other methods vector through this. When gathering the information on source and target, the compound transliterator makes things complicated. For example, suppose we have: Global FILTER = [ax] a > b; :: NULL; b > c; x > d;While the filter just allows a and x, b is an intermediate result, which could produce c. So the source and target sets cannot be gathered independently. What we have to do is filter the sources for the first transliterator according to the global filter, intersect that transliterator's filter. Based on that we get the target. The next transliterator gets as a global filter (global + last target). And so on. There is another complication: Global FILTER = [ax] a >|b; b >c;Even though b would be filtered from the input, whenever we have a backup, it could be part of the input. So ideally we will change the global filter as we go.
| |
| handleTransliterate | back to summary |
|---|---|
| protected void handleTransliterate(Replaceable text, Transliterator. Implements abstract com. Implements
| |
| register | back to summary |
|---|---|
| pack-priv static void register() Registers standard variants with the system. Called by Transliterator during initialization. | |