org.apache.camel.support
Class TokenPairExpressionIterator
java.lang.Object
org.apache.camel.support.ExpressionSupport
org.apache.camel.support.ExpressionAdapter
org.apache.camel.support.TokenPairExpressionIterator
- All Implemented Interfaces:
- Expression, Predicate
- Direct Known Subclasses:
- TokenXMLPairExpressionIterator
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.
startToken
protected final String startToken
endToken
protected final String endToken
includeTokens
protected final boolean includeTokens
TokenPairExpressionIterator
public TokenPairExpressionIterator(String startToken,
String endToken,
boolean includeTokens)
matches
public boolean matches(Exchange exchange)
- Description copied from interface:
Predicate
- Evaluates the predicate on the message exchange and returns true if this
exchange matches the predicate
- Specified by:
matches
in interface Predicate
- Overrides:
matches
in class ExpressionSupport
- Parameters:
exchange
- the message exchange
- Returns:
- true if the predicate matches
evaluate
public Object evaluate(Exchange exchange)
- Overrides:
evaluate
in class ExpressionSupport
doEvaluate
protected Object doEvaluate(Exchange exchange,
boolean closeStream)
- Strategy to evaluate the exchange
- Parameters:
exchange
- the exchangecloseStream
- whether to close the stream before returning from this method.
- Returns:
- the evaluated value
createIterator
protected Iterator<?> createIterator(InputStream in,
String charset)
- Strategy to create the iterator
- Parameters:
in
- input stream to iteratecharset
- charset
- Returns:
- the iterator
toString
public String toString()
- Overrides:
toString
in class Object
Apache Camel