JNIEXPORT void JNICALL Java_com_uber_h3core_NativeMethods_directedEdgeToCells()

in src/main/c/h3-java/src/jniapi.c [1253:1273]


JNIEXPORT void JNICALL Java_com_uber_h3core_NativeMethods_directedEdgeToCells(
    JNIEnv *env, jobject thiz, jlong h3, jlongArray results) {
    jsize sz = (**env).GetArrayLength(env, results);
    jlong *resultsElements = (**env).GetLongArrayElements(env, results, 0);

    if (resultsElements != NULL) {
        // if sz is too small, we will fail to write all the elements
        if (sz >= 2) {
            H3Error err = directedEdgeToCells(h3, resultsElements);
            if (err) {
                ThrowH3Exception(env, err);
            }
        } else {
            ThrowOutOfMemoryError(env);
        }

        (**env).ReleaseLongArrayElements(env, results, resultsElements, 0);
    } else {
        ThrowOutOfMemoryError(env);
    }
}