T
- The type of the events written to this segment.@Beta
public interface SegmentIterator<T>
extends java.util.Iterator<T>, java.lang.AutoCloseable
Iterator.next()
for each event in
the segment at the time of its creation. Once all the events that were in the segment at the time
of the creation of the SegmentIterator have been returned Iterator.hasNext()
will return false.
While buffering is used to avoid it, it is possible for Iterator.next()
to block on fetching the
data.
At any time getOffset()
can be called to get the byte offset in the segment the iterator
is currently pointing to. This can be used to call
BatchClient.readSegment(io.pravega.client.segment.impl.Segment, io.pravega.client.stream.Serializer, long, long)
to create another SegmentIterator at this offset.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator, freeing any resources associated with it.
|
long |
getOffset()
Provides an offset which can be used to re-create a segmentIterator at this position by
calling
BatchClient#readSegment(io.pravega.client.segment.impl.Segment, io.pravega.client.stream.Serializer, long) . |
long getOffset()
BatchClient#readSegment(io.pravega.client.segment.impl.Segment, io.pravega.client.stream.Serializer, long)
.void close()
close
in interface java.lang.AutoCloseable
AutoCloseable.close()