static public void destroy(File path, NativeOptions options) throws IOException, DBException { checkArgNotNull(options, "options"); checkArgNotNull(path, "path"); checkStatus(DBJNI.DestroyDB(path.getCanonicalPath(), options)); }
public NativeComparator() { super(ComparatorJNI.create()); try { name_buffer = NativeBuffer.create(name()); globalRef = NativeDB.DBJNI.NewGlobalRef(this); if( globalRef==0 ) { throw new RuntimeException("jni call failed: NewGlobalRef"); } ComparatorJNI struct = new ComparatorJNI(); struct.compare_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "compare", "(JJ)I"); if( struct.compare_method==0 ) { throw new RuntimeException("jni call failed: GetMethodID"); } struct.target = globalRef; struct.name = name_buffer.pointer(); ComparatorJNI.memmove(self, struct, ComparatorJNI.SIZEOF); } catch (RuntimeException e) { delete(); throw e; } }
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 { long s = DBJNI.Get(self, options, keySlice, result.pointer()); NativeStatus status = new NativeStatus(s); try { if(status.isOk()) { return result.toByteArray(); } if(status.isNotFound()) { return null; } throw new DBException(status.toString(), status.isNotFound()); } finally { status.delete(); } } finally { result.delete(); } }
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; }
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 { long s = DBJNI.Get(self, options, keySlice, result.pointer()); NativeStatus status = new NativeStatus(s); try { if(status.isOk()) { return result.toByteArray(); } if(status.isNotFound()) { return null; } throw new DBException(status.toString(), status.isNotFound()); } finally { status.delete(); } } finally { result.delete(); } }
public NativeComparator() { super(ComparatorJNI.create()); try { name_buffer = NativeBuffer.create(name()); globalRef = NativeDB.DBJNI.NewGlobalRef(this); if( globalRef==0 ) { throw new RuntimeException("jni call failed: NewGlobalRef"); } ComparatorJNI struct = new ComparatorJNI(); struct.compare_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "compare", "(JJ)I"); if( struct.compare_method==0 ) { throw new RuntimeException("jni call failed: GetMethodID"); } struct.target = globalRef; struct.name = name_buffer.pointer(); ComparatorJNI.memmove(self, struct, ComparatorJNI.SIZEOF); } catch (RuntimeException e) { delete(); throw e; } }
private byte[] get(NativeReadOptions options, NativeSlice keySlice) throws DBException { assertAllocated(); NativeStdString result = new NativeStdString(); try { long s = DBJNI.Get(self, options, keySlice, result.pointer()); NativeStatus status = new NativeStatus(s); try { if(status.isOk()) { return result.toByteArray(); } if(status.isNotFound()) { return null; } throw new DBException(status.toString(), status.isNotFound()); } finally { status.delete(); } } finally { result.delete(); } }
public NativeLogger() { super(LoggerJNI.create()); try { globalRef = NativeDB.DBJNI.NewGlobalRef(this); if( globalRef==0 ) { throw new RuntimeException("jni call failed: NewGlobalRef"); } LoggerJNI struct = new LoggerJNI(); struct.log_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "log", "(Ljava/lang/String;)V"); if( struct.log_method ==0 ) { throw new RuntimeException("jni call failed: GetMethodID"); } struct.target = globalRef; LoggerJNI.memmove(self, struct, LoggerJNI.SIZEOF); } catch (RuntimeException e) { delete(); throw e; } }
public NativeComparator() { super(ComparatorJNI.create()); try { name_buffer = NativeBuffer.create(name()); globalRef = NativeDB.DBJNI.NewGlobalRef(this); if( globalRef==0 ) { throw new RuntimeException("jni call failed: NewGlobalRef"); } ComparatorJNI struct = new ComparatorJNI(); struct.compare_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "compare", "(JJ)I"); if( struct.compare_method==0 ) { throw new RuntimeException("jni call failed: GetMethodID"); } struct.target = globalRef; struct.name = name_buffer.pointer(); ComparatorJNI.memmove(self, struct, ComparatorJNI.SIZEOF); } catch (RuntimeException e) { delete(); throw e; } }
public NativeLogger() { super(LoggerJNI.create()); try { globalRef = NativeDB.DBJNI.NewGlobalRef(this); if( globalRef==0 ) { throw new RuntimeException("jni call failed: NewGlobalRef"); } LoggerJNI struct = new LoggerJNI(); struct.log_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "log", "(Ljava/lang/String;)V"); if( struct.log_method ==0 ) { throw new RuntimeException("jni call failed: GetMethodID"); } struct.target = globalRef; LoggerJNI.memmove(self, struct, LoggerJNI.SIZEOF); } catch (RuntimeException e) { delete(); throw e; } }
public NativeLogger() { super(LoggerJNI.create()); try { globalRef = NativeDB.DBJNI.NewGlobalRef(this); if( globalRef==0 ) { throw new RuntimeException("jni call failed: NewGlobalRef"); } LoggerJNI struct = new LoggerJNI(); struct.log_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "log", "(Ljava/lang/String;)V"); if( struct.log_method ==0 ) { throw new RuntimeException("jni call failed: GetMethodID"); } struct.target = globalRef; LoggerJNI.memmove(self, struct, LoggerJNI.SIZEOF); } catch (RuntimeException e) { delete(); throw e; } }
public NativeSnapshot getSnapshot() { return new NativeSnapshot(DBJNI.GetSnapshot(self)); }
public NativeSnapshot getSnapshot() { return new NativeSnapshot(DBJNI.GetSnapshot(self)); }
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(); } }
private void delete(NativeWriteOptions options, NativeSlice keySlice) throws DBException { assertAllocated(); checkStatus(DBJNI.Delete(self, options, keySlice)); }
public NativeSnapshot getSnapshot() { return new NativeSnapshot(DBJNI.GetSnapshot(self)); }
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(); } }
private void compactRange( NativeSlice beginSlice, NativeSlice endSlice) { assertAllocated(); DBJNI.CompactRange(self, beginSlice, endSlice); }