JNIWrapper Class Reference

JNI Wrapper. More...

#include <JNIWrapper.h>

List of all members.

Static Public Member Functions

static void checkException (JNIEnv *env)
 Checks for JNI exceptions.
static bool testException (JNIEnv *env)
 Test if an exception has occurred.
static void fatalError (JNIEnv *env, const char *errorMessage)
 Prints the error message and terminates virtual machine.
static void throwInternalError (JNIEnv *env, const char *errorMessage=0)
 Throws java's internal error.
static void throwOutOfMemoryError (JNIEnv *env, const char *errorMessage=0)
 Throws java's out of memory error.
static void throwRuntimeExcpetion (JNIEnv *env, const char *exceptionMessage=0)
 Throws java's runtime exception.
static jfieldID getFieldID (JNIEnv *env, jclass cls, const char *name, const char *sig)
 Returns the fieldID for an instance field of a class.
static jfieldID getStaticFieldID (JNIEnv *env, jclass cls, const char *name, const char *sig)
 Returns the field ID for a static field of a class or interface.
static jmethodID getMethodID (JNIEnv *env, jclass cls, const char *name, const char *sig)
 Returns the methodID for an instance method of a class or interface.
static jmethodID getStaticMethodID (JNIEnv *env, jclass cls, const char *name, const char *sig)
 Returns the method ID for a static method of a class.
static jobject getObjectField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the object field of the specified object.
static void setObjectField (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val)
 Sets the value of the object field of the specified object.
static jboolean getBooleanField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the boolean field of the specified object.
static void setBooleanField (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val)
 Sets the value of the boolean field of the specified object.
static jbyte getByteField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the byte field of the specified object.
static void setByteField (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val)
 Sets the value of the byte field of the specified object.
static jchar getCharField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the char field of the specified object.
static void setCharField (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val)
 Sets the value of the char field of the specified object.
static jshort getShortField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the short field of the specified object.
static void setShortField (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val)
 Sets the value of the short field of the specified object.
static jint getIntField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the int field of the specified object.
static void setIntField (JNIEnv *env, jobject obj, jfieldID fieldID, jint val)
 Sets the value of the int field of the specified object.
static jlong getLongField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the long field of the specified object.
static void setLongField (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val)
 Sets the value of the long field of the specified object.
static jfloat getFloatField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the float field of the specified object.
static void setFloatField (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val)
 Sets the value of the float field of the specified object.
static jdouble getDoubleField (JNIEnv *env, jobject obj, jfieldID fieldID)
 Returns the value of the double field of the specified object.
static void setDoubleField (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val)
 Sets the value of the double field of the specified object.
static bool callObjectMethod (JNIEnv *env, jobject &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI object method.
static bool callObjectMethod (JNIEnv *env, jobject &result, jobject obj, jmethodID methodID,...)
 Calls JNI object method.
static bool callBooleanMethod (JNIEnv *env, jboolean &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI boolean method.
static bool callBooleanMethod (JNIEnv *env, jboolean &result, jobject obj, jmethodID methodID,...)
 Calls JNI boolean method.
static bool callByteMethod (JNIEnv *env, jbyte &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI byte method.
static bool callByteMethod (JNIEnv *env, jbyte &result, jobject obj, jmethodID methodID,...)
 Calls JNI byte method.
static bool callCharMethod (JNIEnv *env, jchar &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI char method.
static bool callCharMethod (JNIEnv *env, jchar &result, jobject obj, jmethodID methodID,...)
 Calls JNI char method.
static bool callShortMethod (JNIEnv *env, jshort &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI short method.
static bool callShortMethod (JNIEnv *env, jshort &result, jobject obj, jmethodID methodID,...)
 Calls JNI short method.
static bool callIntMethod (JNIEnv *env, jint &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI int method.
static bool callIntMethod (JNIEnv *env, jint &result, jobject obj, jmethodID methodID,...)
 Calls JNI int method.
static bool callLongMethod (JNIEnv *env, jlong &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI long method.
static bool callLongMethod (JNIEnv *env, jlong &result, jobject obj, jmethodID methodID,...)
 Calls JNI long method.
static bool callFloatMethod (JNIEnv *env, jfloat &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI float method.
static bool callFloatMethod (JNIEnv *env, jfloat &result, jobject obj, jmethodID methodID,...)
 Calls JNI float method.
static bool callDoubleMethod (JNIEnv *env, jdouble &result, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI double method.
static bool callDoubleMethod (JNIEnv *env, jdouble &result, jobject obj, jmethodID methodID,...)
 Calls JNI double method.
static bool callVoidMethod (JNIEnv *env, jobject obj, jmethodID methodID, va_list &args)
 Calls JNI void method.
static bool callVoidMethod (JNIEnv *env, jobject obj, jmethodID methodID,...)
 Calls JNI void method.
static jstring toString (JNIEnv *env, jobject obj)
 Returns jstring representation of the specified object.
static jstring newString (JNIEnv *env, const jchar *uchars, jsize len)
 Creates new Java string.
static jstring newStringUTF (JNIEnv *env, const char *bytes)
 Creates new Java string.
static bool callStaticVoidMethod (JNIEnv *env, jclass cls, jmethodID methodID, va_list &args)
 Calls JNI static void method.
static bool callStaticVoidMethod (JNIEnv *env, jclass cls, jmethodID methodID,...)
 Calls JNI static void method.
static bool callStaticIntMethod (JNIEnv *env, jint &result, jclass cls, jmethodID methodID, va_list &args)
 Calls JNI static int method.
static bool callStaticIntMethod (JNIEnv *env, jint &result, jclass cls, jmethodID methodID,...)
 Calls JNI static void method.
static jobject newObject (JNIEnv *env, jclass cls, jmethodID constructor, va_list &args)
 Creates and constructs new Java object.
static jobject newObject (JNIEnv *env, jclass cls, jmethodID constructor,...)
 Creates and constructs new Java object.
static jobjectArray newObjectArray (JNIEnv *env, jclass cls, jsize len)
 Creates new java object array.
static jobjectArray newStringArray (JNIEnv *env, jsize len)
 Creates new java string array.
static jbyteArray newByteArray (JNIEnv *env, jsize len)
 Creates new java byte array.
static jobject newGlobalRef (JNIEnv *env, jobject obj)
 Returns new Java global reference to the specified Java object.
static jweak newWeakGlobalRef (JNIEnv *env, jobject obj)
 Returns new Java weak reference to the specified Java object.
static void deleteGlobalRef (JNIEnv *env, jobject &objref)
 Deletes the Java reference.
static void deleteWeakGlobalRef (JNIEnv *env, jweak &wobjref)
 Deletes the Java weak reference.
static bool isLiveRef (JNIEnv *env, jweak wobjref)
 Returns true if the specified weak reference is alive.
static jclass objectClass ()
 Returns object class.
static jclass stringClass ()
 Returns string class.
static jmethodID toStringMID ()
 Returns toString method ID.

Friends

class JVMWrapper


Detailed Description

JNI Wrapper.

Author:
Slobodan Vrkacevic (slobodan.vrkacevic@gmail.com)
Version:
0.2.0

Member Function Documentation

void JNIWrapper::checkException ( JNIEnv *  env  )  [static]

Checks for JNI exceptions.

Parameters:
env the JNIEnv pointer

bool JNIWrapper::testException ( JNIEnv *  env  )  [static]

Test if an exception has occurred.

Parameters:
env the JNIEnv pointer
Returns:
true if the exception has occurred

void JNIWrapper::fatalError ( JNIEnv *  env,
const char *  errorMessage 
) [static]

Prints the error message and terminates virtual machine.

NOTE: This method does not return.

Parameters:
env the JNIEnv pointer
errorMessage the error message

void JNIWrapper::throwInternalError ( JNIEnv *  env,
const char *  errorMessage = 0 
) [static]

Throws java's internal error.

Parameters:
env the JNIEnv pointer
errorMessage the error message

void JNIWrapper::throwOutOfMemoryError ( JNIEnv *  env,
const char *  errorMessage = 0 
) [static]

Throws java's out of memory error.

Parameters:
env the JNIEnv pointer
errorMessage the error message

void JNIWrapper::throwRuntimeExcpetion ( JNIEnv *  env,
const char *  exceptionMessage = 0 
) [static]

Throws java's runtime exception.

Parameters:
env the JNIEnv pointer
exceptionMessage the exception message

jfieldID JNIWrapper::getFieldID ( JNIEnv *  env,
jclass  cls,
const char *  name,
const char *  sig 
) [static]

Returns the fieldID for an instance field of a class.

Parameters:
env the JNIEnv pointer
cls the class
name the field name
sig the field signature
Returns:
the fieldID for an instance field of a class

jfieldID JNIWrapper::getStaticFieldID ( JNIEnv *  env,
jclass  cls,
const char *  name,
const char *  sig 
) [static]

Returns the field ID for a static field of a class or interface.

Parameters:
env the JNIEnv pointer
cls the class
name the field name
sig the field signature
Returns:
the field ID for a static field of a class or interface

jmethodID JNIWrapper::getMethodID ( JNIEnv *  env,
jclass  cls,
const char *  name,
const char *  sig 
) [static]

Returns the methodID for an instance method of a class or interface.

Parameters:
env the JNIEnv pointer
cls the class
name the method name
sig the method signature
Returns:
the methodID for an instance method of a class or interface

jmethodID JNIWrapper::getStaticMethodID ( JNIEnv *  env,
jclass  cls,
const char *  name,
const char *  sig 
) [static]

Returns the method ID for a static method of a class.

Parameters:
env the JNIEnv pointer
cls the class
name the method name
sig the method signature
Returns:
the method ID for a static method of a class

jobject JNIWrapper::getObjectField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the object field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the object field of the specified object

void JNIWrapper::setObjectField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jobject  val 
) [static]

Sets the value of the object field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jboolean JNIWrapper::getBooleanField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the boolean field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the boolean field of the specified object

void JNIWrapper::setBooleanField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jboolean  val 
) [static]

Sets the value of the boolean field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jbyte JNIWrapper::getByteField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the byte field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the byte field of the specified object

void JNIWrapper::setByteField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jbyte  val 
) [static]

Sets the value of the byte field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jchar JNIWrapper::getCharField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the char field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the char field of the specified object

void JNIWrapper::setCharField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jchar  val 
) [static]

Sets the value of the char field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jshort JNIWrapper::getShortField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the short field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the short field of the specified object

void JNIWrapper::setShortField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jshort  val 
) [static]

Sets the value of the short field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jint JNIWrapper::getIntField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the int field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the int field of the specified object

void JNIWrapper::setIntField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jint  val 
) [static]

Sets the value of the int field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jlong JNIWrapper::getLongField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the long field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the long field of the specified object

void JNIWrapper::setLongField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jlong  val 
) [static]

Sets the value of the long field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jfloat JNIWrapper::getFloatField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the float field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the float field of the specified object

void JNIWrapper::setFloatField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jfloat  val 
) [static]

Sets the value of the float field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

jdouble JNIWrapper::getDoubleField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID 
) [static]

Returns the value of the double field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
Returns:
the value of the double field of the specified object

void JNIWrapper::setDoubleField ( JNIEnv *  env,
jobject  obj,
jfieldID  fieldID,
jdouble  val 
) [static]

Sets the value of the double field of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
fieldID the field ID
val the new value

bool JNIWrapper::callObjectMethod ( JNIEnv *  env,
jobject &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI object method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callObjectMethod ( JNIEnv *  env,
jobject &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI object method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callBooleanMethod ( JNIEnv *  env,
jboolean &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI boolean method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callBooleanMethod ( JNIEnv *  env,
jboolean &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI boolean method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callByteMethod ( JNIEnv *  env,
jbyte &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI byte method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callByteMethod ( JNIEnv *  env,
jbyte &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI byte method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callCharMethod ( JNIEnv *  env,
jchar &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI char method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callCharMethod ( JNIEnv *  env,
jchar &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI char method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callShortMethod ( JNIEnv *  env,
jshort &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI short method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callShortMethod ( JNIEnv *  env,
jshort &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI short method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callIntMethod ( JNIEnv *  env,
jint &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI int method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callIntMethod ( JNIEnv *  env,
jint &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI int method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callLongMethod ( JNIEnv *  env,
jlong &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI long method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callLongMethod ( JNIEnv *  env,
jlong &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI long method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callFloatMethod ( JNIEnv *  env,
jfloat &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI float method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callFloatMethod ( JNIEnv *  env,
jfloat &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI float method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callDoubleMethod ( JNIEnv *  env,
jdouble &  result,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI double method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callDoubleMethod ( JNIEnv *  env,
jdouble &  result,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI double method.

Parameters:
env the JNIEnv pointer
result the result
obj the jobject
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callVoidMethod ( JNIEnv *  env,
jobject  obj,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI void method.

Parameters:
env the JNIEnv pointer
obj the java object
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callVoidMethod ( JNIEnv *  env,
jobject  obj,
jmethodID  methodID,
  ... 
) [static]

Calls JNI void method.

Parameters:
env the JNIEnv pointer
obj the java object
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

jstring JNIWrapper::toString ( JNIEnv *  env,
jobject  obj 
) [static]

Returns jstring representation of the specified object.

Parameters:
env the JNIEnv pointer
obj the object
Returns:
jstring representation of the specified object

jstring JNIWrapper::newString ( JNIEnv *  env,
const jchar *  uchars,
jsize  len 
) [static]

Creates new Java string.

Parameters:
env the JNIEnv pointer
uchars the unicode char array
len the length of the char array
Returns:
new Java string object

jstring JNIWrapper::newStringUTF ( JNIEnv *  env,
const char *  bytes 
) [static]

Creates new Java string.

Parameters:
env the JNIEnv pointer
bytes the UTF-8 char array
Returns:
new Java string object

bool JNIWrapper::callStaticVoidMethod ( JNIEnv *  env,
jclass  cls,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI static void method.

Parameters:
env the JNIEnv pointer
cls the java class
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callStaticVoidMethod ( JNIEnv *  env,
jclass  cls,
jmethodID  methodID,
  ... 
) [static]

Calls JNI static void method.

Parameters:
env the JNIEnv pointer
cls the java class
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callStaticIntMethod ( JNIEnv *  env,
jint &  result,
jclass  cls,
jmethodID  methodID,
va_list &  args 
) [static]

Calls JNI static int method.

Parameters:
env the JNIEnv pointer
result the result
cls the java class
methodID the method ID
args the method arguments
Returns:
true if no exception is thrown

bool JNIWrapper::callStaticIntMethod ( JNIEnv *  env,
jint &  result,
jclass  cls,
jmethodID  methodID,
  ... 
) [static]

Calls JNI static void method.

Parameters:
env the JNIEnv pointer
result the result
cls the java class
methodID the method ID
... the method arguments
Returns:
true if no exception is thrown

jobject JNIWrapper::newObject ( JNIEnv *  env,
jclass  cls,
jmethodID  constructor,
va_list &  args 
) [static]

Creates and constructs new Java object.

Parameters:
env the JNIEnv pointer
cls the object class
constructor the class constructor
args the constructor arguments
Returns:
new Java object

jobject JNIWrapper::newObject ( JNIEnv *  env,
jclass  cls,
jmethodID  constructor,
  ... 
) [static]

Creates and constructs new Java object.

Parameters:
env the JNIEnv pointer
cls the object class
constructor the class constructor
... the constructor arguments
Returns:
new Java object

jobjectArray JNIWrapper::newObjectArray ( JNIEnv *  env,
jclass  cls,
jsize  len 
) [static]

Creates new java object array.

Parameters:
env the JNIEnv pointer
cls the class of the array elements
len the length of the array
Returns:
the java object array

jobjectArray JNIWrapper::newStringArray ( JNIEnv *  env,
jsize  len 
) [static]

Creates new java string array.

Parameters:
env the JNIEnv pointer
len the length of the array
Returns:
the java string array

jbyteArray JNIWrapper::newByteArray ( JNIEnv *  env,
jsize  len 
) [static]

Creates new java byte array.

Parameters:
env the JNIEnv pointer
len the length of the array
Returns:
the java byte array

jobject JNIWrapper::newGlobalRef ( JNIEnv *  env,
jobject  obj 
) [static]

Returns new Java global reference to the specified Java object.

Parameters:
env the JNIEnv pointer
obj the Java object
Returns:
new Java global reference to the specified Java object

jweak JNIWrapper::newWeakGlobalRef ( JNIEnv *  env,
jobject  obj 
) [static]

Returns new Java weak reference to the specified Java object.

Parameters:
env the JNIEnv pointer
obj the Java object
Returns:
new Java weak reference to the specified Java object

void JNIWrapper::deleteGlobalRef ( JNIEnv *  env,
jobject &  objref 
) [static]

Deletes the Java reference.

Parameters:
env the JNIEnv pointer
objref the Java reference

void JNIWrapper::deleteWeakGlobalRef ( JNIEnv *  env,
jweak &  wobjref 
) [static]

Deletes the Java weak reference.

Parameters:
env the JNIEnv pointer
wobjref the Java weak reference

bool JNIWrapper::isLiveRef ( JNIEnv *  env,
jweak  wobjref 
) [static]

Returns true if the specified weak reference is alive.

Parameters:
env the JNIEnv pointer
wobjref the Java weak reference
Returns:
true if the specified weak reference is alive

jclass JNIWrapper::objectClass (  )  [inline, static]

Returns object class.

Returns:
object class

jclass JNIWrapper::stringClass (  )  [inline, static]

Returns string class.

Returns:
string class

jmethodID JNIWrapper::toStringMID (  )  [inline, static]

Returns toString method ID.

Returns:
toString method ID


Copyright © 2007 ETF and contributors. All Rights Reserved.