Class TokenPairExpressionIterator

All Implemented Interfaces:
org.apache.camel.Expression, org.apache.camel.Predicate

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 Details

    • startToken

      protected final String startToken
    • endToken

      protected final String endToken
    • includeTokens

      protected final boolean includeTokens
  • Constructor Details

    • TokenPairExpressionIterator

      public TokenPairExpressionIterator(String startToken, String endToken, boolean includeTokens)
  • Method Details

    • init

      public void init(org.apache.camel.CamelContext context)
      Specified by:
      init in interface org.apache.camel.Expression
      Specified by:
      init in interface org.apache.camel.Predicate
      Overrides:
      init in class ExpressionAdapter
    • matches

      public boolean matches(org.apache.camel.Exchange exchange)
      Specified by:
      matches in interface org.apache.camel.Predicate
      Overrides:
      matches in class ExpressionSupport
    • evaluate

      public Object evaluate(org.apache.camel.Exchange exchange)
      Overrides:
      evaluate in class ExpressionSupport
    • doEvaluate

      protected Object doEvaluate(org.apache.camel.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(org.apache.camel.Exchange exchange, InputStream in, String charset)
      Strategy to create the iterator
      Parameters:
      exchange - the exchange
      in - input stream to iterate
      charset - charset
      Returns:
      the iterator
    • toString

      public String toString()
      Overrides:
      toString in class Object