public class TokenPairExpressionIterator extends ExpressionAdapter
Expression
to walk a Message
body using an Iterator
, which
grabs the content between a start and end token.
The message body must be able to convert to InputStream
type which is used as stream to access the message
body.
For splitting XML files use TokenXMLExpressionIterator
instead.Modifier and Type | Field and Description |
---|---|
protected String |
endToken |
protected boolean |
includeTokens |
protected String |
startToken |
Constructor and Description |
---|
TokenPairExpressionIterator(String startToken,
String endToken,
boolean includeTokens) |
Modifier and Type | Method and Description |
---|---|
protected Iterator<?> |
createIterator(org.apache.camel.Exchange exchange,
InputStream in,
String charset)
Strategy to create the iterator
|
protected Object |
doEvaluate(org.apache.camel.Exchange exchange,
boolean closeStream)
Strategy to evaluate the exchange
|
Object |
evaluate(org.apache.camel.Exchange exchange) |
void |
init(org.apache.camel.CamelContext context) |
boolean |
matches(org.apache.camel.Exchange exchange) |
String |
toString() |
assertionFailureMessage, evaluate
assertMatches
protected final String startToken
protected final String endToken
protected final boolean includeTokens
public void init(org.apache.camel.CamelContext context)
init
in interface org.apache.camel.Expression
init
in interface org.apache.camel.Predicate
init
in class ExpressionSupport
public boolean matches(org.apache.camel.Exchange exchange)
matches
in interface org.apache.camel.Predicate
matches
in class ExpressionSupport
public Object evaluate(org.apache.camel.Exchange exchange)
evaluate
in class ExpressionSupport
protected Object doEvaluate(org.apache.camel.Exchange exchange, boolean closeStream)
exchange
- the exchangecloseStream
- whether to close the stream before returning from this method.protected Iterator<?> createIterator(org.apache.camel.Exchange exchange, InputStream in, String charset)
exchange
- the exchangein
- input stream to iteratecharset
- charsetApache Camel