PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms 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. public class main {
  2. static {
  3. try {
  4. System.loadLibrary("example");
  5. } catch (UnsatisfiedLinkError e) {
  6. 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);
  7. System.exit(1);
  8. }
  9. }
  10. public static void main(String argv[]) {
  11. String s = "brave new world";
  12. example.f1(s);
  13. System.out.println("f1(String): " + s);
  14. byte b[] = new byte[25];
  15. example.f2(b);
  16. System.out.println("f2(byte[]): " + new String(b));
  17. StringBuffer sb = new StringBuffer(20);
  18. example.f3(sb);
  19. System.out.println("f3(StringBuffer): " + sb);
  20. }
  21. }