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)
DataRepository
addItem
in interface DataRepository
public DataInputStream elementAt(long uid, int revision)
DataRepository
elementAt
in interface DataRepository
uid
- 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 DataRepository
public boolean removeDoc(long uid)
uid
.uid
- the element to removepublic void close()
close
in interface DataRepository
public DataRepository.TupleSequence elements()
elements
in interface DataRepository
public void flush()
flush
in interface DataRepository
Copyright © 2016 Egothor. All Rights Reserved.