org.apache.camel.support
Class TokenPairExpressionIterator

java.lang.Object
  extended by org.apache.camel.support.ExpressionSupport
      extended by org.apache.camel.support.ExpressionAdapter
          extended by 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.


Field Summary
protected  String endToken
           
protected  boolean includeTokens
           
protected  String startToken
           
 
Constructor Summary
TokenPairExpressionIterator(String startToken, String endToken, boolean includeTokens)
           
 
Method Summary
protected  Iterator<?> createIterator(InputStream in, String charset)
          Strategy to create the iterator
protected  Object doEvaluate(Exchange exchange, boolean closeStream)
          Strategy to evaluate the exchange
 Object evaluate(Exchange exchange)
           
 boolean matches(Exchange exchange)
          Evaluates the predicate on the message exchange and returns true if this exchange matches the predicate
 String toString()
           
 
Methods inherited from class org.apache.camel.support.ExpressionAdapter
assertionFailureMessage, evaluate
 
Methods inherited from class org.apache.camel.support.ExpressionSupport
assertMatches
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startToken

protected final String startToken

endToken

protected final String endToken

includeTokens

protected final boolean includeTokens
Constructor Detail

TokenPairExpressionIterator

public TokenPairExpressionIterator(String startToken,
                                   String endToken,
                                   boolean includeTokens)
Method Detail

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 exchange
closeStream - 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 iterate
charset - charset
Returns:
the iterator

toString

public String toString()
Overrides:
toString in class Object


Apache CAMEL