it.unimi.dsi.mg4j.document
Class AbstractDocumentSequence
java.lang.Object
it.unimi.dsi.mg4j.document.AbstractDocumentSequence
- All Implemented Interfaces:
- SafelyCloseable, DocumentSequence, Closeable
- Direct Known Subclasses:
- AbstractDocumentCollection, CompositeDocumentSequence
public abstract class AbstractDocumentSequence
- extends Object
- implements DocumentSequence, SafelyCloseable
An abstract, safely closeable
implementation of a document sequence.
Note that even if your DocumentSequence
implementation does not allocate
any specific resource, it is nonetheless a good idea to inherit from this class, as tracking
missing calls to close()
will be easier to detect.
Method Summary |
void |
close()
Closes this document sequence, releasing all resources. |
protected void |
finalize()
|
AbstractDocumentSequence
public AbstractDocumentSequence()
finalize
protected void finalize()
throws Throwable
- Overrides:
finalize
in class Object
- Throws:
Throwable
close
public void close()
throws IOException
- Description copied from interface:
DocumentSequence
- Closes this document sequence, releasing all resources.
You should always call this method after having finished with this document sequence.
Implementations are invited to call this method in a finaliser as a safety net (even better,
implement SafelyCloseable
), but since there
is no guarantee as to when finalisers are invoked, you should not depend on this behaviour.
- Specified by:
close
in interface DocumentSequence
- Specified by:
close
in interface Closeable
- Throws:
IOException