public class EncoderOutput
extends java.lang.Object
Constructor and Description |
---|
EncoderOutput(TextChunk inputChunk) |
Modifier and Type | Method and Description |
---|---|
EncoderOutput |
addChunk(java.lang.CharSequence text)
Add a new text chunk to the output of origin
TextChunk.Origin.INPUT and content type "text/plain" |
EncoderOutput |
addChunk(TextChunk.Origin origin,
java.lang.String contentType,
java.lang.CharSequence text)
Add a new text chunk to the output
|
EncoderOutput |
chainEncoder(WGAEncoder encoder)
Chains another encoder that should run after this encoder run finishes.
|
EncoderOutput |
clearChunks()
Removes all already added chunks
|
java.util.List<WGAEncoder> |
getChainedEncoders()
Returns encoders that were chained after the current encoder run
|
java.util.List<TextChunk> |
getOutputChunks()
Returns the added chunks
|
EncoderOutput |
ignoreChunk()
Notifies that the encoder ignores the current text chunk, which will be kept unmodified.
|
EncoderOutput |
replaceChunk(java.lang.String text)
Replaces text of the input chunk with the given chunk text, keeping the origin of the original chunk
|
EncoderOutput |
replaceChunkViaRegex(java.util.regex.Pattern pattern,
java.lang.String replacement)
Replaces parts of the input chunk using a regular expression.
|
public EncoderOutput(TextChunk inputChunk)
public java.util.List<WGAEncoder> getChainedEncoders()
public EncoderOutput addChunk(TextChunk.Origin origin, java.lang.String contentType, java.lang.CharSequence text)
origin
- The origin of the chunkcontentType
- The content type of the chunktext
- The textpublic EncoderOutput addChunk(java.lang.CharSequence text)
TextChunk.Origin.INPUT
and content type "text/plain"origin
- The origin of the chunkcontentType
- The content type of the chunktext
- The textpublic EncoderOutput ignoreChunk()
public EncoderOutput replaceChunk(java.lang.String text)
public EncoderOutput clearChunks()
public java.util.List<TextChunk> getOutputChunks()
public EncoderOutput chainEncoder(WGAEncoder encoder)
encoder
- The encoder to chainpublic EncoderOutput replaceChunkViaRegex(java.util.regex.Pattern pattern, java.lang.String replacement)
TextChunk.Origin.ADDED
and the unmodified parts have origin TextChunk.Origin.INPUT
pattern
- The regex pattern for replacementreplacement
- The replacement string. This supports the group variables known from Matcher.appendReplacement(StringBuffer, String)
on the state of Java SE 6, so the string "$0" will be replaced by the whole matched string, "$1" by the first matching group, "$2" the second and so on.