summaryrefslogtreecommitdiffstats
path: root/libwebp_jni_example.java
blob: d28d9b822d652cede79ca19f8aa6e393e01d091c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import com.google.webp.libwebp;

import java.lang.reflect.Method;

public class libwebp_jni_example {
  static {
    try {
      System.load("/usr/lib64/libwebp-java/libwebp_jni.so");
    } catch (UnsatisfiedLinkError e) {
      System.load("/usr/lib/libwebp-java/libwebp_jni.so");
    }
  }

  /**
   * usage: java -cp libwebp.jar:. libwebp_jni_example
   */
  public static void main(String argv[]) {
    final int version = libwebp.WebPGetDecoderVersion();
    System.out.println("libwebp version: " + Integer.toHexString(version));

    System.out.println("libwebp methods:");
    final Method[] libwebpMethods = libwebp.class.getDeclaredMethods();
    for (int i = 0; i < libwebpMethods.length; i++) {
      System.out.println(libwebpMethods[i]);
    }
  }
}