Package org.apache.camel.support
Class GroupTokenIterator
- java.lang.Object
-
- org.apache.camel.support.GroupTokenIterator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<Object>
public final class GroupTokenIterator extends Object implements Iterator<Object>, Closeable
Group basedIteratorwhich groups the givenIteratora number of times and then return a combined response as a String. This implementation uses an internal byte array buffer, to combine the response. The token is inserted between the individual parts. For example if you group by new line, then a new line token is inserted between the lines.
-
-
Constructor Summary
Constructors Constructor Description GroupTokenIterator(org.apache.camel.Exchange exchange, Iterator<?> it, String token, int group, boolean skipFirst)Creates a new token based group iterator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanhasNext()Objectnext()voidremove()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
GroupTokenIterator
public GroupTokenIterator(org.apache.camel.Exchange exchange, Iterator<?> it, String token, int group, boolean skipFirst)Creates a new token based group iterator- Parameters:
exchange- the exchange used to create this group iteratorit- the iterator to grouptoken- then token used to separate between the parts, use null to not add the tokengroup- number of parts to group together- Throws:
IllegalArgumentException- is thrown if group is not a positive number
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-