public class DocumentsDB extends Object implements DataRepository
uid the algorithm works as follows:
DataRepository.TupleSequence| Constructor and Description |
|---|
DocumentsDB(String location,
boolean compressed)
Constructor for the DocumentsDB object.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addItem(long uid,
byte[] document,
int length)
Adds another document into the repository.
|
void |
close()
Closes the structure.
|
void |
destroy()
Destroy this data structure.
|
DataInputStream |
elementAt(long uid,
int revision)
Retrieves a data block.
|
DataRepository.TupleSequence |
elements()
The tuples are [long:uid;int:rev;Object:DataInputStream].
|
void |
flush() |
boolean |
removeDoc(long uid)
Removes an element of the given
uid. |
public DocumentsDB(String location, boolean compressed)
location - the location where the files will be createdcompressed - true iff the DocumentData will be saved in gzip formatpublic int addItem(long uid,
byte[] document,
int length)
DataRepositoryaddItem in interface DataRepositorypublic DataInputStream elementAt(long uid, int revision)
DataRepositoryelementAt in interface DataRepositoryuid - the key of the blockrevision - revision number of the block, 0 is used for the latest (current) revisionpublic void destroy()
close(). Then
it removes these files from the directory where the structure is
stored: bitmap, idocs, docs.destroy in interface DataRepositorypublic boolean removeDoc(long uid)
uid.uid - the element to removepublic void close()
close in interface DataRepositorypublic DataRepository.TupleSequence elements()
elements in interface DataRepositorypublic void flush()
flush in interface DataRepositoryCopyright © 2016 Egothor. All Rights Reserved.