Top Description Fields Constructors Methods
org.apache.commons.lang3.text.translate

public Class LookupTranslator

extends CharSequenceTranslator
Class Inheritance
Annotations
@Deprecated
Imports
java.io.IOException, .Writer, java.util.HashMap, .HashSet

Deprecated

As of 3.6, use Apache Commons Text LookupTranslator.

Translates a value using a lookup table.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final int
private final HashMap<String, String>
private final HashSet<Character>
private final int
Inherited from org.apache.commons.lang3.text.translate.CharSequenceTranslator:
HEX_DIGITS

Constructor Summary

AccessConstructor and Description
public
LookupTranslator(final CharSequence[]...
CharSequence[][] table of size [*][2]
lookup
)

Define the lookup table to be used in translation Note that, as of Lang 3.1, the key to the lookup table is converted to a java.lang.String.

Method Summary

Modifier and TypeMethod and Description
public int
translate(final CharSequence input, final int index, final Writer out)

Implements abstract org.apache.commons.lang3.text.translate.CharSequenceTranslator.translate.

Translate a set of code points, represented by an int index into a CharSequence, into another set of code points.

Inherited from org.apache.commons.lang3.text.translate.CharSequenceTranslator:
hextranslatetranslatewith

Field Detail

longestback to summary
private final int longest
lookupMapback to summary
private final HashMap<String, String> lookupMap
prefixSetback to summary
private final HashSet<Character> prefixSet
shortestback to summary
private final int shortest

Constructor Detail

LookupTranslatorback to summary
public LookupTranslator(final CharSequence[]... lookup)

Define the lookup table to be used in translation Note that, as of Lang 3.1, the key to the lookup table is converted to a java.lang.String. This is because we need the key to support hashCode and equals(Object), allowing it to be the key for a HashMap. See LANG-882.

Parameters
lookup:CharSequence[][]

CharSequence[][] table of size [*][2]

Method Detail

translateback to summary
public int translate(final CharSequence input, final int index, final Writer out) throws IOException

Implements abstract org.apache.commons.lang3.text.translate.CharSequenceTranslator.translate.

Doc from org.apache.commons.lang3.text.translate.CharSequenceTranslator.translate.

Translate a set of code points, represented by an int index into a CharSequence, into another set of code points. The number of code points consumed must be returned, and the only IOExceptions thrown must be from interacting with the Writer so that the top level API may reliably ignore StringWriter IOExceptions.

Annotations
@Override
Exceptions
IOException:
if and only if the Writer produces an IOException.