|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.di.mg4j.document.AbstractDocumentSequence
it.unimi.di.mg4j.document.AbstractDocumentCollection
it.unimi.di.mg4j.document.ConcatenatedDocumentCollection
public class ConcatenatedDocumentCollection
A document collection exhibiting a list of underlying document collections, called segments, as a single collection. The underlying collections are (virtually) concatenated—that is, the first document of the second collection is renumbered to the size of the first collection, and so on. All underlying collections must use the same factory class.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class it.unimi.di.mg4j.document.AbstractDocumentCollection |
|---|
AbstractDocumentCollection.PropertyKeys |
| Field Summary |
|---|
| Fields inherited from interface it.unimi.di.mg4j.document.DocumentCollection |
|---|
DEFAULT_EXTENSION |
| Constructor Summary | |
|---|---|
|
ConcatenatedDocumentCollection(String... collectionName)
Creates a new, partially uninitialised concatenated document collection using giving component collections names. |
protected |
ConcatenatedDocumentCollection(String[] collectionName,
DocumentCollection[] collection)
Creates a new concatenated document collection using giving component collections. |
| Method Summary | |
|---|---|
void |
close()
Closes this document sequence, releasing all resources. |
DocumentCollection |
copy()
|
Document |
document(int index)
Returns the document given its index. |
DocumentFactory |
factory()
Returns the factory used by this sequence. |
void |
filename(CharSequence filename)
Does nothing. |
Reference2ObjectMap<Enum<?>,Object> |
metadata(int index)
Returns the metadata map for a document. |
int |
size()
Returns the number of documents in this collection. |
InputStream |
stream(int index)
Returns an input stream for the raw content of a document. |
| Methods inherited from class it.unimi.di.mg4j.document.AbstractDocumentCollection |
|---|
ensureDocumentIndex, iterator, main, printAllDocuments, toString |
| Methods inherited from class it.unimi.di.mg4j.document.AbstractDocumentSequence |
|---|
finalize, load |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected ConcatenatedDocumentCollection(String[] collectionName,
DocumentCollection[] collection)
collection - a list of component collections.
public ConcatenatedDocumentCollection(String... collectionName)
throws IllegalArgumentException,
SecurityException
collectionName - a list of names of component collections.
IllegalArgumentException
SecurityException| Method Detail |
|---|
public void filename(CharSequence filename)
AbstractDocumentSequence
filename in interface DocumentSequencefilename in class AbstractDocumentSequencefilename - the filename of this document sequence.public DocumentCollection copy()
copy in interface DocumentCollectioncopy in interface FlyweightPrototype<DocumentCollection>
public Document document(int index)
throws IOException
DocumentCollection
document in interface DocumentCollectionindex - an index between 0 (inclusive) and DocumentCollection.size() (exclusive).
index-th document.
IOException
public Reference2ObjectMap<Enum<?>,Object> metadata(int index)
throws IOException
DocumentCollection
metadata in interface DocumentCollectionindex - an index between 0 (inclusive) and DocumentCollection.size() (exclusive).
IOExceptionpublic int size()
DocumentCollection
size in interface DocumentCollection
public InputStream stream(int index)
throws IOException
DocumentCollection
stream in interface DocumentCollectionindex - an index between 0 (inclusive) and DocumentCollection.size() (exclusive).
IOExceptionpublic DocumentFactory factory()
DocumentSequenceEvery document sequence is based on a document factory that transforms raw bytes into a sequence of characters. The factory contains useful information such as the number of fields.
factory in interface DocumentSequence
public void close()
throws IOException
DocumentSequenceYou 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 DocumentSequenceclose in interface Closeableclose in class AbstractDocumentSequenceIOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||