LevelDB implements AutoCloseable { public void write(LevelDBWriteBatch writeBatch, LevelDBWriteOptions writeOptions) { checkDatabaseOpen(); writeOptions.checkWriteOptionsOpen(); PointerByReference error = new PointerByReference(); LevelDBNative.leveldb_write(levelDB, writeOptions.writeOptions, writeBatch.writeBatch, error); LevelDBNative.checkError(error); } LevelDB(String levelDBDirectory, LevelDBOptions options); void close(); byte[] get(byte[] key, LevelDBReadOptions readOptions); void put(byte[] key, byte[] value, LevelDBWriteOptions writeOptions); void write(LevelDBWriteBatch writeBatch, LevelDBWriteOptions writeOptions); void delete(byte[] key, LevelDBWriteOptions writeOptions); String property(String property); long[] approximateSizes(Range ...ranges); void compactRange(byte[] startKey, byte[] limitKey); static void repair(String levelDBDirectory, LevelDBOptions options); static void destroy(String levelDBDirectory, LevelDBOptions options); static int majorVersion(); static int minorVersion();  }
@Test public void write_empty_write_batch() { try(LevelDBOptions options = new LevelDBOptions()) { options.setCreateIfMissing(true); try (LevelDB levelDB = new LevelDB(testFolder.getRoot().getAbsolutePath(), options)) { try(LevelDBWriteOptions writeOptions = new LevelDBWriteOptions()) { try(LevelDBWriteBatch writeBatch = new LevelDBWriteBatch()) { levelDB.write(writeBatch, writeOptions); } } } } }