Package htsjdk.samtools.filter
Class FilteringSamIterator
- java.lang.Object
-
- htsjdk.samtools.filter.FilteringSamIterator
-
- All Implemented Interfaces:
CloseableIterator<SAMRecord>,Closeable,AutoCloseable,Iterator<SAMRecord>
- Direct Known Subclasses:
FilteringIterator
public class FilteringSamIterator extends Object implements CloseableIterator<SAMRecord>
Filtering Iterator which takes a filter and an iterator and iterates through only those records which are not rejected by the filter. $Id$
-
-
Constructor Summary
Constructors Constructor Description FilteringSamIterator(Iterator<SAMRecord> iterator, SamRecordFilter filter)ConstructorFilteringSamIterator(Iterator<SAMRecord> iterator, SamRecordFilter filter, boolean filterByPair)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Should be implemented to close/release any underlying resources.booleanhasNext()Returns true if the iteration has more elements.SAMRecordnext()Returns the next element in the iteration.voidremove()Required method for Iterator API.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface htsjdk.samtools.util.CloseableIterator
stream, toList
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
FilteringSamIterator
public FilteringSamIterator(Iterator<SAMRecord> iterator, SamRecordFilter filter, boolean filterByPair)
Constructor- Parameters:
iterator- the backing iteratorfilter- the filter (which may be a FilterAggregator)filterByPair- if true, filter reads in pairs
-
FilteringSamIterator
public FilteringSamIterator(Iterator<SAMRecord> iterator, SamRecordFilter filter)
Constructor- Parameters:
iterator- the backing iteratorfilter- the filter (which may be a FilterAggregator)
-
-
Method Detail
-
hasNext
public boolean hasNext()
Returns true if the iteration has more elements.
-
next
public SAMRecord next()
Returns the next element in the iteration.- Specified by:
nextin interfaceIterator<SAMRecord>- Returns:
- the next element in the iteration
- Throws:
NoSuchElementException
-
remove
public void remove()
Required method for Iterator API.- Specified by:
removein interfaceIterator<SAMRecord>- Throws:
UnsupportedOperationException
-
close
public void close()
Description copied from interface:CloseableIteratorShould be implemented to close/release any underlying resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<SAMRecord>
-
-