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]); }
private void put(NativeWriteOptions options, NativeSlice keySlice, NativeSlice valueSlice) throws DBException { assertAllocated(); checkStatus(DBJNI.Put(self, options, keySlice, valueSlice)); }
public void compactRange(byte[] begin, byte[] end) throws DBException { if( db==null ) { throw new DBException("Closed"); } db.compactRange(begin, end); }
static public void repair(File path, NativeOptions options) throws IOException, DBException { checkArgNotNull(options, "options"); checkArgNotNull(path, "path"); checkStatus(DBJNI.RepairDB(path.getCanonicalPath(), options)); } }
public void delete(NativeWriteOptions options, byte[] key) throws DBException { checkArgNotNull(options, "options"); checkArgNotNull(key, "key"); NativeBuffer keyBuffer = NativeBuffer.create(key); try { delete(options, keyBuffer); } finally { keyBuffer.delete(); } }
public NativeRange(byte[] start, byte[] limit) { NativeDB.checkArgNotNull(start, "start"); NativeDB.checkArgNotNull(limit, "limit"); this.limit = limit; this.start = start; } }
public void delete() { assertAllocated(); DBJNI.delete(self); self = 0; }
public byte[] get(NativeReadOptions options, byte[] key) throws DBException { checkArgNotNull(options, "options"); checkArgNotNull(key, "key"); NativeBuffer keyBuffer = NativeBuffer.create(key); try { return get(options, keyBuffer); } finally { keyBuffer.delete(); } }
public String getProperty(String name) { checkArgNotNull(name, "name"); NativeBuffer keyBuffer = NativeBuffer.create(name.getBytes()); try { byte[] property = getProperty(keyBuffer); if( property==null ) { return null; } else { return new String(property); } } finally { keyBuffer.delete(); } }
public void put(NativeWriteOptions options, byte[] key, byte[] value) throws DBException { checkArgNotNull(options, "options"); checkArgNotNull(key, "key"); checkArgNotNull(value, "value"); NativeBuffer keyBuffer = NativeBuffer.create(key); try { NativeBuffer valueBuffer = NativeBuffer.create(value); try { put(options, keyBuffer, valueBuffer); } finally { valueBuffer.delete(); } } finally { keyBuffer.delete(); } }
private void delete(NativeWriteOptions options, NativeBuffer keyBuffer) throws DBException { delete(options, new NativeSlice(keyBuffer)); }
public String getProperty(String name) { if( db==null ) { throw new DBException("Closed"); } return db.getProperty(name); }
private byte[] get(NativeReadOptions options, NativeBuffer keyBuffer) throws DBException { return get(options, new NativeSlice(keyBuffer)); }
public void destroy(File path, Options options) throws IOException { OptionsResourceHolder holder = new OptionsResourceHolder(); try { holder.init(options); NativeDB.destroy(path, holder.options); } finally { holder.close(); } }
public long[] getApproximateSizes(Range... ranges) { if( db==null ) { throw new DBException("Closed"); } NativeRange args[] = new NativeRange[ranges.length]; for (int i = 0; i < args.length; i++) { args[i] = new NativeRange(ranges[i].start(), ranges[i].limit()); } return db.getApproximateSizes(args); }
private void checkStatus() throws NativeDB.DBException { NativeDB.checkStatus(IteratorJNI.status(self)); }
static public void destroy(File path, NativeOptions options) throws IOException, DBException { checkArgNotNull(options, "options"); checkArgNotNull(path, "path"); checkStatus(DBJNI.DestroyDB(path.getCanonicalPath(), options)); }
public NativeRange(byte[] start, byte[] limit) { NativeDB.checkArgNotNull(start, "start"); NativeDB.checkArgNotNull(limit, "limit"); this.limit = limit; this.start = start; } }
public void delete(NativeWriteOptions options, byte[] key) throws DBException { checkArgNotNull(options, "options"); checkArgNotNull(key, "key"); NativeBuffer keyBuffer = NativeBuffer.create(key); try { delete(options, keyBuffer); } finally { keyBuffer.delete(); } }
public void delete() { assertAllocated(); DBJNI.delete(self); self = 0; }