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

public abstract Class CharSequenceTranslator

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.lang3.text.translate.CodePointTranslator, org.apache.commons.lang3.text.translate.LookupTranslator, org.apache.commons.lang3.text.translate.NumericEntityUnescaper, org.apache.commons.lang3.text.translate.OctalUnescaper, org.apache.commons.lang3.text.translate.UnicodeUnescaper, org.apache.commons.lang3.StringEscapeUtils.CsvEscaper, org.apache.commons.lang3.StringEscapeUtils.CsvUnescaper, org.apache.commons.lang3.text.translate.AggregateTranslator
Annotations
@Deprecated
Imports
java.io.IOException, .StringWriter, .UncheckedIOException, .Writer, java.util.Locale, .Objects, org.apache.commons.lang3.ArrayUtils

Deprecated

As of 3.6, use Apache Commons Text CharSequenceTranslator.

An API for translating text. Its core use is to escape and unescape text. Because escaping and unescaping is completely contextual, the API does not present two separate signatures.
Since
3.0

Field Summary

Modifier and TypeField and Description
pack-priv static final char[]

Constructor Summary

AccessConstructor and Description
public
CharSequenceTranslator()

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

An upper case hexadecimal String.
hex
(final int
The code point to convert.
codePoint
)

Returns an upper case hexadecimal String for the given character.

public final String

Returns:

String output of translation.
translate
(final CharSequence
CharSequence to be translated.
input
)

Helper for non-Writer usage.

public abstract int

Returns:

int count of code points consumed.
translate
(CharSequence
CharSequence that is being translated.
input
,
int
int representing the current point of translation.
index
,
Writer
Writer to translate the text to.
out
)

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

public final void
translate(final CharSequence
CharSequence that is being translated.
input
,
final Writer
Writer to translate the text to.
writer
)

Translate an input onto a Writer.

public final CharSequenceTranslator

Returns:

CharSequenceTranslator merging this translator with the others.
with
(final CharSequenceTranslator...
CharSequenceTranslator array of translators to merge with this one.
translators
)
References Deprecated CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.

Helper method to create a merger of this translator with another set of translators.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HEX_DIGITSback to summary
pack-priv static final char[] HEX_DIGITS

Constructor Detail

CharSequenceTranslatorback to summary
public CharSequenceTranslator()

Constructs a new instance.

Method Detail

hexback to summary
public static String hex(final int codePoint)

Returns an upper case hexadecimal String for the given character.

Parameters
codePoint:int

The code point to convert.

Returns:String

An upper case hexadecimal String.

translateback to summary
public final String translate(final CharSequence input)

Helper for non-Writer usage.

Parameters
input:CharSequence

CharSequence to be translated.

Returns:String

String output of translation.

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

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.

Parameters
input:CharSequence

CharSequence that is being translated.

index:int

int representing the current point of translation.

out:Writer

Writer to translate the text to.

Returns:int

int count of code points consumed.

Exceptions
IOException:
if and only if the Writer produces an IOException.
translateback to summary
public final void translate(final CharSequence input, final Writer writer) throws IOException

Translate an input onto a Writer. This is intentionally final as its algorithm is tightly coupled with the abstract method of this class.

Parameters
input:CharSequence

CharSequence that is being translated.

writer:Writer

Writer to translate the text to.

Annotations
@SuppressWarnings:resource
Exceptions
IOException:
if and only if the Writer produces an IOException.
withback to summary
public final CharSequenceTranslator with(final CharSequenceTranslator... translators)

References Deprecated

CharSequenceTranslator is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Helper method to create a merger of this translator with another set of translators. Useful in customizing the standard functionality.

Parameters
translators:CharSequenceTranslator[]

CharSequenceTranslator array of translators to merge with this one.

Returns:CharSequenceTranslator

CharSequenceTranslator merging this translator with the others.