// Quickly load it back
Key loaded = storage.load(NATIVE_STORE.toURI());
assert(original.buildData().build().equals(loaded.buildData().build()));
// Use Store API for more elaborate operations
Store store = null;
try {
// Open a SQLite database store
store = storage.open(
"sqlite:" + SQLITE_DATABASE.toURI().getRawPath() + "#samekey");
// Save previously loaded key
store.save(loaded);
// Check store is not empty and load key back
if (!store.isEmpty()) {
Key sameKey = store.load();
assert(loaded.buildData().build().equals(sameKey.buildData().build()));
}
} finally {
// Close store
if (store != null) {
store.close();
}
}
}