org.apache.camel.util
Class GroupIterator
java.lang.Object
org.apache.camel.util.GroupIterator
- All Implemented Interfaces:
- Closeable, Iterator<Object>
public final class GroupIterator
- extends Object
- implements Iterator<Object>, Closeable
Group based Iterator
which groups the given Iterator
a number of times
and then return a combined response as a String.
This implementation uses as 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GroupIterator
public GroupIterator(CamelContext camelContext,
Iterator<?> it,
String token,
int group)
- Creates a new group iterator
- Parameters:
camelContext
- the camel contextit
- 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
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Throws:
IOException
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<Object>
next
public Object next()
- Specified by:
next
in interface Iterator<Object>
remove
public void remove()
- Specified by:
remove
in interface Iterator<Object>
Apache Camel