Mercurial > hg > audiodb
comparison bindings/java/src/org/omras2/AudioDB.java @ 724:11fd16e1d8b3
* Initial code for status call (populating Status)
* Storing adb handle within Java object
author | mas01mj |
---|---|
date | Wed, 14 Jul 2010 17:21:24 +0000 |
parents | 56e97aa9d0ae |
children | 7e1fa27b67ee |
comparison
equal
deleted
inserted
replaced
723:ca11b72f92b6 | 724:11fd16e1d8b3 |
---|---|
4 | 4 |
5 public class AudioDB | 5 public class AudioDB |
6 { | 6 { |
7 public native boolean audiodb_create(String path, int datasize, int ntracks, int datadim); | 7 public native boolean audiodb_create(String path, int datasize, int ntracks, int datadim); |
8 public native boolean audiodb_open(String path, Mode mode); | 8 public native boolean audiodb_open(String path, Mode mode); |
9 public native void audiodb_status(); | 9 public native Status audiodb_status(); |
10 | 10 |
11 public native void insert(); | 11 // public native void insert(); |
12 public native void query(); | 12 // public native void query(); |
13 public native void status(); | |
14 | 13 |
15 public enum Mode { O_RDONLY, O_RDRW } | 14 public enum Mode { O_RDONLY, O_RDRW } |
16 | 15 |
17 private File path; | 16 private File path; |
17 private long adbHandle; | |
18 | 18 |
19 public AudioDB(File path) | 19 public AudioDB(File path) |
20 { | 20 { |
21 this.path = path; | 21 this.path = path; |
22 } | 22 } |
29 public boolean open(Mode mode) | 29 public boolean open(Mode mode) |
30 { | 30 { |
31 return audiodb_open(path.toString(), mode); | 31 return audiodb_open(path.toString(), mode); |
32 } | 32 } |
33 | 33 |
34 public void getStatus() | 34 public Status getStatus() |
35 { | 35 { |
36 audiodb_status(); | 36 return audiodb_status(); |
37 } | 37 } |
38 | 38 |
39 static { | 39 static { |
40 System.loadLibrary("AudioDB_JNI"); | 40 System.loadLibrary("AudioDB_JNI"); |
41 } | 41 } |
43 | 43 |
44 public static void main(String args[]) | 44 public static void main(String args[]) |
45 { | 45 { |
46 AudioDB testDB = new AudioDB(new File("test.adb")); | 46 AudioDB testDB = new AudioDB(new File("test.adb")); |
47 testDB.create(5, 5, 12); | 47 testDB.create(5, 5, 12); |
48 testDB.open(Mode.O_RDRW); | 48 // testDB.open(Mode.O_RDRW); |
49 // testDB.getStatus(); | 49 Status status = testDB.getStatus(); |
50 System.out.println("Num files: "+status.getNumFiles()); | |
50 } | 51 } |
51 } | 52 } |
52 | 53 |
53 | 54 |