Package it.unimi.dsi.law.warc.io
Class WarcFilteredIterator
java.lang.Object
it.unimi.dsi.law.warc.io.WarcFilteredIterator
- All Implemented Interfaces:
Iterator<WarcRecord>
public class WarcFilteredIterator extends Object implements Iterator<WarcRecord>
A class to iterate over WARC files getting only records that satisfy a given filter.
-
Constructor Summary
Constructors Constructor Description WarcFilteredIterator(FastBufferedInputStream in, WarcRecord record, Filter<WarcRecord> filter)
Builds the filtered iterator.WarcFilteredIterator(FastBufferedInputStream in, WarcRecord record, Filter<WarcRecord> filter, ProgressLogger pl)
Builds the filtered iterator. -
Method Summary
Modifier and Type Method Description boolean
hasNext()
WarcRecord
next()
void
remove()
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 Details
-
WarcFilteredIterator
public WarcFilteredIterator(FastBufferedInputStream in, WarcRecord record, Filter<WarcRecord> filter, ProgressLogger pl)Builds the filtered iterator.This constructor takes a
WarcRecord
(or aGZWarcRecord
if the stream contains compressed records) that will be reused (and thus modified) by calls tohasNext()
andnext()
.- Parameters:
in
- the input stream.record
- the record used for reading.filter
- the filter.pl
- a (pre-initialized)ProgressLogger
that will be updated during reads.
-
WarcFilteredIterator
public WarcFilteredIterator(FastBufferedInputStream in, WarcRecord record, Filter<WarcRecord> filter)Builds the filtered iterator.This constructor takes a
WarcRecord
(or aGZWarcRecord
if the stream contains compressed records) that will be reused (and thus modified) by calls tohasNext()
andnext()
.- Parameters:
in
- the input stream.record
- the record used for reading.filter
- the filter.
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<WarcRecord>
-
next
- Specified by:
next
in interfaceIterator<WarcRecord>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<WarcRecord>
-