Source code: demo/chapters/ichi/rawExample/Simple.java
1 package demo.chapters.ichi.rawExample;
2
3 public class Simple
4 {
5 static
6 {
7 System.loadLibrary( "Simple" );
8 }
9
10 private long handle = 0;
11
12 protected native void init();
13 protected native void uninit();
14 public native void loadByID(String id);
15 public native String getLegacyData();
16
17 public Simple()
18 {
19 init();
20 }
21
22 protected void finalize()
23 {
24 uninit();
25 }
26
27 public static void main(String[] args)
28 {
29 try
30 {
31 Simple s1 = new Simple();
32 Simple s2 = new Simple();
33 s1.loadByID( "s1ID" );
34 s2.loadByID( "s2ID" );
35 System.out.println( "s1.getLegacyData() == \"" + s1.getLegacyData() + "\"" );
36 System.out.println( "s2.getLegacyData() == \"" + s2.getLegacyData() + "\"" );
37 s1.loadByID( null );
38 }
39 catch(Exception ex)
40 {
41 System.out.println( "Caught exception:" );
42 ex.printStackTrace();
43 }
44 }
45 }