|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.di.mg4j.document.AbstractDocumentSequence
public abstract class AbstractDocumentSequence
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.
Constructor Summary | |
---|---|
AbstractDocumentSequence()
|
Method Summary | |
---|---|
void |
close()
Closes this document sequence, releasing all resources. |
void |
filename(CharSequence filename)
Does nothing. |
protected void |
finalize()
|
static DocumentSequence |
load(CharSequence filename)
Loads a sequence. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.unimi.di.mg4j.document.DocumentSequence |
---|
factory, iterator |
Constructor Detail |
---|
public AbstractDocumentSequence()
Method Detail |
---|
public static DocumentSequence load(CharSequence filename) throws IOException, ClassNotFoundException, IllegalArgumentException, SecurityException
This method first deserialises the object specified by the given filename, and
then invokes DocumentSequence.filename(CharSequence)
to ensure proper relativisation
of serialised filenames.
filename
- a filename that will be used to load a serialised sequence.
IOException
ClassNotFoundException
IllegalArgumentException
SecurityException
public void filename(CharSequence filename) throws IOException
filename
in interface DocumentSequence
filename
- the filename of this document sequence.
IOException
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public void close() throws IOException
DocumentSequence
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.
close
in interface DocumentSequence
close
in interface Closeable
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |