CodePointTranslator

@Deprecated public abstract class org.apache.commons.lang3.text.translate.CodePointTranslator extends CharSequenceTranslator[source]

Deprecated: As of 3.6, use Apache Commons Text CharSequenceTranslator.

Helper subclass to CharSequenceTranslator to allow for translations that will replace up to one character at a time.

Since:

3.0

Constructors

CodePointTranslator()

Constructs a new instance.

public CodePointTranslator()[source]

Constructs a new instance.

Methods

translate(int, Writer)

Translate the specified code point into another.

translate(CharSequence, int, Writer)

Implements translate to map onto the abstract translate(int, Writer) method.

public abstract boolean translate(int codePoint, Writer out) throws IOException[source]

Translate the specified code point into another.

Parameters:
  • codePoint – int character input to translate.

  • out – Writer to optionally push the translated output to.

Returns:

boolean as to whether translation occurred or not.

Throws:

java.io.IOException – Thrown if and only if the Writer produces an IOException.

@Override public final int translate(CharSequence input, int index, Writer out) throws IOException[source]

Implements translate to map onto the abstract translate(int, Writer) method. 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 that is being translated.

  • index – int representing the current point of translation.

  • out – Writer to translate the text to.

Returns:

int count of code points consumed.

Throws:

java.io.IOException – Thrown if and only if the Writer produces an IOException.