proxygen
JniUtils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <fizz/record/Types.h>
12 #include <folly/Range.h>
13 #include <jni.h>
14 
15 namespace fizz {
16 namespace jni {
17 
18 void setVM(JavaVM* vm);
19 
20 JNIEnv* getEnv(bool* shouldDetach);
21 void releaseEnv(bool shouldDetach);
22 
23 jclass getClass(JNIEnv* env, const std::string& name);
24 
25 jmethodID getMethodID(
26  JNIEnv* env,
27  jclass clazz,
28  const std::string& name,
29  const std::string& signature);
30 
31 void maybeThrowException(JNIEnv* env, bool shouldDetach);
32 
33 jbyteArray createByteArray(JNIEnv* env, folly::ByteRange byteRange);
34 jbyteArray createByteArray(JNIEnv* env, Buf buf);
35 
36 } // namespace jni
37 } // namespace fizz
jclass getClass(JNIEnv *env, const std::string &name)
Definition: JniUtils.cpp:46
const char * name
Definition: http_parser.c:437
void maybeThrowException(JNIEnv *env, bool shouldDetach)
Definition: JniUtils.cpp:63
void setVM(JavaVM *jvm)
Definition: JniUtils.cpp:19
void releaseEnv(bool shouldDetach)
Definition: JniUtils.cpp:40
Definition: Actions.h:16
JNIEnv * getEnv(bool *shouldDetach)
Definition: JniUtils.cpp:23
jmethodID getMethodID(JNIEnv *env, jclass clazz, const std::string &name, const std::string &signature)
Definition: JniUtils.cpp:53
const char * string
Definition: Conv.cpp:212
std::unique_ptr< folly::IOBuf > Buf
Definition: Types.h:22
jbyteArray createByteArray(JNIEnv *env, folly::ByteRange byteRange)
Definition: JniUtils.cpp:72