Line | |
---|
1 | /**
|
---|
2 | * @file jni.h
|
---|
3 | * @author myusgun@gmail.com
|
---|
4 | * @brief JNI
|
---|
5 | */
|
---|
6 | #ifndef __cf_jni_h__
|
---|
7 | #define __cf_jni_h__
|
---|
8 |
|
---|
9 | #include "cf/bin.h"
|
---|
10 | #include "cf/exception.h"
|
---|
11 |
|
---|
12 | #include <jni.h>
|
---|
13 | #include <string>
|
---|
14 |
|
---|
15 | namespace cf
|
---|
16 | {
|
---|
17 | /**
|
---|
18 | * jni
|
---|
19 | */
|
---|
20 | class jni
|
---|
21 | {
|
---|
22 | private:
|
---|
23 | JNIEnv * mJNIEnv;
|
---|
24 |
|
---|
25 | cf::void_t releaseString(jstring jinput,
|
---|
26 | cf::char_t * in);
|
---|
27 |
|
---|
28 | cf::void_t releaseByteArray(jbyteArray jinput,
|
---|
29 | cf::char_t * in);
|
---|
30 |
|
---|
31 | cf::void_t releaseLocalMemory(jobject in);
|
---|
32 |
|
---|
33 | public:
|
---|
34 | /* from java */
|
---|
35 | bin getByteArray(jbyteArray jinput)
|
---|
36 | throw (cf::exception);
|
---|
37 |
|
---|
38 | std::string getString(jstring jinput)
|
---|
39 | throw (cf::exception);
|
---|
40 |
|
---|
41 | /* to java */
|
---|
42 | cf::void_t throwException(const char * message);
|
---|
43 |
|
---|
44 | jbyteArray newByteArray(const bin & in);
|
---|
45 |
|
---|
46 | jstring newString(const std::string & in);
|
---|
47 | };
|
---|
48 | }
|
---|
49 |
|
---|
50 | #endif // #ifndef __cf_jni_h__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.