Package it.unimi.di.big.mg4j.document
Interface DocumentIterator
-
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
AbstractDocumentIterator
,JdbcDocumentCollection.JdbcDocumentIterator
public interface DocumentIterator extends Closeable
An iterator over documents.This interface provide a
nextDocument()
method returning the next document, ornull
if no more documents are available. Usually you would need toDocument.close()
each document when you are finished with it, but in the present case it is guaranteed that each call tonextDocument()
will close the previously returned document.An additional
close()
method releases all resources used by the iterator. Implementations are invited to besafely closeable
.
-
-
Method Summary
Modifier and Type Method Description void
close()
Closes this document iterator, releasing all resources.Document
nextDocument()
Returns the next document.
-
-
-
Method Detail
-
nextDocument
Document nextDocument() throws IOException
Returns the next document.- Returns:
- the next document, or
null
if there are no other documents. - Throws:
IOException
-
close
void close() throws IOException
Closes this document iterator, releasing all resources.You should always call this method after having finished with this iterator. Implementations are invited to call this method in a finaliser as a safety net, but since there is no guarantee as to when finalisers are invoked, you should not depend on this behaviour.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-