public class CrawlLogIterator extends Object implements AutoCloseable, Iterable<CrawlDataItem>, Iterator<CrawlDataItem>
| Constructor and Description |
|---|
CrawlLogIterator(InputStream stream) |
CrawlLogIterator(Path path)
Create a new CrawlLogIterator that reads items from a Heritrix crawl.log
|
CrawlLogIterator(Reader reader) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the crawl.log file.
|
boolean |
hasNext()
Returns true if there are more items available.
|
Iterator<CrawlDataItem> |
iterator() |
CrawlDataItem |
next()
Returns the next valid item from the crawl log.
|
protected CrawlDataItem |
parseLine(String line)
Parse the a line in the crawl log.
|
protected void |
prepareNext()
Ready the next item.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorforEachRemaining, removepublic CrawlLogIterator(Path path) throws IOException
path - The path of a Heritrix crawl.log file.IOException - If errors were found reading the log.public CrawlLogIterator(Reader reader)
public CrawlLogIterator(InputStream stream)
public boolean hasNext()
hasNext in interface Iterator<CrawlDataItem>public CrawlDataItem next()
next in interface Iterator<CrawlDataItem>UncheckedIOException - If there is an error reading the item *after* the
item to be returned from the crawl.log.NoSuchElementException - If there are no more itemsprotected void prepareNext()
throws IOException
Note: This method should only be called when next==null
IOExceptionprotected CrawlDataItem parseLine(String line) throws IOException
Override this method to change how individual crawl log items are processed and accepted/rejected. This method is called from within the loop in prepareNext().
line - A line from the crawl log. Must not be null.CrawlDataItem if the next line in the crawl log yielded
a usable item, null otherwise.IOExceptionpublic void close()
throws IOException
close in interface AutoCloseableIOExceptionpublic Iterator<CrawlDataItem> iterator()
iterator in interface Iterable<CrawlDataItem>Copyright © 2019. All rights reserved.