sglang_v0.5.2/pytorch_2.8.0/android/libs/fbjni
hailin c8e8c1e9ff . 2025-09-20 16:09:34 +08:00
..
cxx . 2025-09-20 16:09:34 +08:00
docs . 2025-09-20 16:09:34 +08:00
gradle . 2025-09-20 16:09:34 +08:00
java/com/facebook/jni . 2025-09-20 16:09:34 +08:00
manifest . 2025-09-20 16:09:34 +08:00
scripts . 2025-09-20 16:09:34 +08:00
test . 2025-09-20 16:09:34 +08:00
.gitignore . 2025-09-20 16:09:34 +08:00
CMakeLists.txt . 2025-09-20 16:09:34 +08:00
CODE_OF_CONDUCT.md . 2025-09-20 16:09:34 +08:00
CONTRIBUTING.md . 2025-09-20 16:09:34 +08:00
LICENSE . 2025-09-20 16:09:34 +08:00
README.md . 2025-09-20 16:09:34 +08:00
build.gradle . 2025-09-20 16:09:34 +08:00
googletest-CMakeLists.txt.in . 2025-09-20 16:09:34 +08:00
gradle.properties . 2025-09-20 16:09:34 +08:00
gradlew . 2025-09-20 16:09:34 +08:00
gradlew.bat . 2025-09-20 16:09:34 +08:00
host.gradle . 2025-09-20 16:09:34 +08:00
settings.gradle . 2025-09-20 16:09:34 +08:00

README.md

fbjni

The Facebook JNI helpers library is designed to simplify usage of the Java Native Interface. The helpers were implemented to ease the integration of cross-platform mobile code on Android, but there are no Android specifics in the design. It can be used with any Java VM that supports JNI.

struct JMyClass : JavaClass<JMyClass> {
  static constexpr auto kJavaDescriptor = "Lcom/example/MyClass;";

  // Automatic inference of Java method descriptors.
  static std::string concatenate(
      alias_ref<JClass> clazz,
      // Automatic conversion to std::string.
      std::string prefix) {
    // Call methods easily.
    static const auto getSuffix = clazz->getStaticMethod<JString()>("getSuffix");
    // Manage JNI references automatically.
    local_ref<JString> jstr = getSuffix(clazz);
    // Automatic exception translation between Java and C++ (both ways).
    // No need to check exception state after each call.
    result += jstr->toStdString();
    // Automatic conversion from std::string.
    return result;
  }
};

Documentation

License

fbjni is Apache-2 licensed, as found in the LICENSE file.