PageRenderTime 90ms CodeModel.GetById 54ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/java/typemap/main.java

#
Java | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 54aac4cf6eb046eb8a5f86203bd6ed8d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1
 2public class main {
 3
 4  static {
 5    try {
 6	System.loadLibrary("example");
 7    } catch (UnsatisfiedLinkError e) {
 8      System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
 9      System.exit(1);
10    }
11  }
12
13  public static void main(String argv[]) {
14    String s = "brave new world";
15    example.f1(s);
16    System.out.println("f1(String): " + s);
17
18    byte b[] = new byte[25];
19    example.f2(b);
20    System.out.println("f2(byte[]): " + new String(b));
21
22    StringBuffer sb = new StringBuffer(20);
23    example.f3(sb);
24    System.out.println("f3(StringBuffer): " + sb);
25  }
26}