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

public Class AggregateTranslator

extends CharSequenceTranslator
Class Inheritance
Imports
java.io.IOException, .Writer, java.util.ArrayList, .List, .Objects, java.util.stream.Stream

Executes a sequence of translators one after the other. Execution ends whenever the first translator consumes code points from the input.
Since
1.0

Field Summary

Modifier and TypeField and Description
private final List<CharSequenceTranslator>
translators

Translator list.

Inherited from org.apache.commons.text.translate.CharSequenceTranslator:
HEX_DIGITS

Constructor Summary

AccessConstructor and Description
public
AggregateTranslator(final CharSequenceTranslator...
CharSequenceTranslator array to aggregate.
translators
)

Specify the translators to be used at creation time.

Method Summary

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

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

The first translator to consume code points from the input is the 'winner'.

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

Field Detail

translatorsback to summary
private final List<CharSequenceTranslator> translators

Translator list.

Constructor Detail

AggregateTranslatorback to summary
public AggregateTranslator(final CharSequenceTranslator... translators)

Specify the translators to be used at creation time.

Parameters
translators:CharSequenceTranslator[]

CharSequenceTranslator array to aggregate.

Method Detail

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

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

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

The first translator to consume code points from the input is the 'winner'. Execution stops with the number of consumed code points being returned. 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.