Class DocumentStore<T extends Document>
- java.lang.Object
-
- org.torproject.metrics.stats.hidserv.DocumentStore<T>
-
public class DocumentStore<T extends Document> extends java.lang.Object
Utility class to store serialized objects implementing the Document interface to a file and later to retrieve them.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<T>
retrieve(java.io.File documentFile)
Retrieves all previously stored documents from the given file.java.util.Set<T>
retrieve(java.io.File documentFile, java.lang.String prefix)
Retrieves previously stored documents from the given file that start with the given prefix.boolean
store(java.io.File documentFile, java.util.Set<T> documentsToStore)
Stores the provided documents in the given file and returns whether the storage operation was successful.
-
-
-
Method Detail
-
store
public boolean store(java.io.File documentFile, java.util.Set<T> documentsToStore)
Stores the provided documents in the given file and returns whether the storage operation was successful.If the file already existed and if it contains documents, merge the new documents with the existing ones.
-
retrieve
public java.util.Set<T> retrieve(java.io.File documentFile)
Retrieves all previously stored documents from the given file.
-
retrieve
public java.util.Set<T> retrieve(java.io.File documentFile, java.lang.String prefix)
Retrieves previously stored documents from the given file that start with the given prefix.
-
-