public static NativeDB open(NativeOptions options, File path) throws IOException, DBException { checkArgNotNull(options, "options"); checkArgNotNull(path, "path"); long rc[] = new long[1]; try { checkStatus(DBJNI.Open(options, path.getCanonicalPath(), rc)); } catch (IOException e) { if (rc[0] != 0) { DBJNI.delete(rc[0]); } throw e; } return new NativeDB(rc[0]); }
public long[] getApproximateSizes(NativeRange... ranges) { if (ranges == null) { return null; } long rc[] = new long[ranges.length]; NativeRange.RangeJNI structs[] = new NativeRange.RangeJNI[ranges.length]; if (rc.length > 0) { NativeBuffer range_array = NativeRange.RangeJNI.arrayCreate(ranges.length); try { for (int i = 0; i < ranges.length; i++) { structs[i] = new NativeRange.RangeJNI(ranges[i]); structs[i].arrayWrite(range_array.pointer(), i); } DBJNI.GetApproximateSizes(self, range_array.pointer(), ranges.length, rc); } finally { for (int i = 0; i < ranges.length; i++) { if (structs[i] != null) { structs[i].delete(); } } range_array.delete(); } } return rc; }
private byte[] get(NativeReadOptions options, NativeSlice keySlice) throws DBException { assertAllocated(); NativeStdString result = new NativeStdString(); try { checkStatus(DBJNI.Get(self, options, keySlice, result.pointer())); return result.toByteArray(); } finally { result.delete(); } }
private byte[] getProperty(NativeSlice nameSlice) { assertAllocated(); NativeStdString result = new NativeStdString(); try { if (DBJNI.GetProperty(self, nameSlice, result.pointer())) { return result.toByteArray(); } else { return null; } } finally { result.delete(); } }
public static void repair(File path, NativeOptions options) throws IOException, DBException { checkArgNotNull(options, "options"); checkArgNotNull(path, "path"); checkStatus(DBJNI.RepairDB(path.getCanonicalPath(), options)); }
public NativeIterator iterator(NativeReadOptions options) { checkArgNotNull(options, "options"); return new NativeIterator(DBJNI.NewIterator(self, options)); }
public void releaseSnapshot(NativeSnapshot snapshot) { checkArgNotNull(snapshot, "snapshot"); DBJNI.ReleaseSnapshot(self, snapshot.pointer()); }
public NativeSnapshot getSnapshot() { return new NativeSnapshot(DBJNI.GetSnapshot(self)); }
public void write(NativeWriteOptions options, NativeWriteBatch updates) throws DBException { checkArgNotNull(options, "options"); checkArgNotNull(updates, "updates"); checkStatus(DBJNI.Write(self, options, updates.pointer())); }
private void delete(NativeWriteOptions options, NativeSlice keySlice) throws DBException { assertAllocated(); checkStatus(DBJNI.Delete(self, options, keySlice)); }
private void put(NativeWriteOptions options, NativeSlice keySlice, NativeSlice valueSlice) throws DBException { assertAllocated(); checkStatus(DBJNI.Put(self, options, keySlice, valueSlice)); }
public void delete() { assertAllocated(); DBJNI.delete(self); self = 0; }