public class DataStore extends Object implements Closeable
| Constructor and Description |
|---|
DataStore(File dataDir,
String filePrefix) |
DataStore(File dataDir,
String filePrefix,
boolean forceSync) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all values from the DataStore.
|
void |
close()
Closes the DataStore, releasing any file references, etc.
|
byte[] |
getData(int id)
Gets the value for the specified ID.
|
int |
getID(byte[] queryData)
Gets the ID for the specified value.
|
int |
getMaxID()
Returns the maximum value-ID that is in use.
|
static void |
main(String[] args) |
int |
storeData(byte[] data)
Stores the supplied value and returns the ID that has been assigned to it.
|
void |
sync()
Synchronizes any recent changes to the data to disk.
|
public DataStore(File dataDir, String filePrefix) throws IOException
IOExceptionpublic DataStore(File dataDir, String filePrefix, boolean forceSync) throws IOException
IOExceptionpublic byte[] getData(int id)
throws IOException
id - A value ID, should be larger than 0.IOException - If an I/O error occurred.public int getID(byte[] queryData)
throws IOException
queryData - The value to get the ID for, must not be null.IOException - If an I/O error occurred.public int getMaxID()
throws IOException
IOException - If an I/O error occurs.public int storeData(byte[] data)
throws IOException
data - The data to store, must not be null.IOException - If an I/O error occurred.public void sync()
throws IOException
IOException - If an I/O error occurred.public void clear()
throws IOException
IOException - If an I/O error occurred.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - If an I/O error occurred.Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.