T
- the class of objects returned by this iteratorpublic class ExtractorIterator<T extends LocalAbstractObject> extends AbstractObjectIterator<T> implements java.io.Closeable
Extractor
.
The iterator is initialized by given extractor and ExtractorDataSource
and
returns objects until the extraction fails or an end of the data source is reached.Constructor and Description |
---|
ExtractorIterator(Extractor<? extends T> extractor,
ExtractorDataSource dataSource)
Creates a new instance of ExtractorIterator.
|
ExtractorIterator(Extractor<? extends T> extractor,
java.lang.String fileName)
Creates a new instance of ExtractorIterator.
|
ExtractorIterator(Extractor<? extends T> extractor,
java.lang.String fileName,
java.util.Map<java.lang.String,? extends java.lang.Object> additionalParameters)
Creates a new instance of ExtractorIterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
T |
getCurrentObject()
Returns an object returned by the last call to
Iterator.next() . |
boolean |
hasNext() |
T |
next() |
void |
remove() |
void |
reset()
Reset the associated data source and restarts the iteration from beginning.
|
emptyIterator, getIterator, getMatchingObjects, getMatchingObjects, getMatchingObjects, getMatchingObjects, getObjectByAnyLocator, getObjectByData, getObjectByLocator, getObjectByLocator, getObjectByLocatorRegexp, getObjectByPosition, getRandomObject, getRandomObjects, provideObjects, singleton, skip
public ExtractorIterator(Extractor<? extends T> extractor, ExtractorDataSource dataSource)
extractor
- the extractor to use for creating objectsdataSource
- the data source for the extractorpublic ExtractorIterator(Extractor<? extends T> extractor, java.lang.String fileName, java.util.Map<java.lang.String,? extends java.lang.Object> additionalParameters) throws java.io.IOException
extractor
- the extractor to use for creating objectsfileName
- the file from which to download the dataadditionalParameters
- the additional parameters for this data sourcejava.io.IOException
- if there was an error opening the filepublic ExtractorIterator(Extractor<? extends T> extractor, java.lang.String fileName) throws java.io.IOException
extractor
- the extractor to use for creating objectsfileName
- the file from which to download the datajava.io.IOException
- if there was an error opening the filepublic T getCurrentObject() throws java.util.NoSuchElementException
AbstractObjectIterator
Iterator.next()
.getCurrentObject
in class AbstractObjectIterator<T extends LocalAbstractObject>
Iterator.next()
java.util.NoSuchElementException
- if Iterator.next()
has not been called yetpublic boolean hasNext()
hasNext
in interface java.util.Iterator<T extends LocalAbstractObject>
public T next() throws java.util.NoSuchElementException
next
in interface java.util.Iterator<T extends LocalAbstractObject>
java.util.NoSuchElementException
public void remove()
remove
in interface java.util.Iterator<T extends LocalAbstractObject>
public void reset() throws java.io.IOException
java.io.IOException
- if there was an I/O error reseting the data sourcepublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException