LevelDB JNI
LevelDB JNI 提供了 Google 高效的Key/Value數據庫 LevelDB 的 Java 接口。
示例代碼:
import org.fusesource.leveldbjni.*;
import static org.fusesource.leveldbjni.DB.*;
import java.io.*;
Options options = new Options();
options.setCreateIfMissing(true);
DB db = DB.open(options, new File("example"));
try {
// Use the db in here....
} finally {
// Make sure you delete the db to shutdown the
// database and avoid resource leaks.
db.delete();
}
WriteOptions wo = new WriteOptions();
ReadOptions ro = new ReadOptions();
db.put(wo, bytes("Tampa"), bytes("rocks"));
String value = asString(db.get(ro, bytes("Tampa")));
db.delete(wo, bytes("Tampa"));
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!