passing Jbytearray to unsigned char

Hello Group:

I am newer in JNI and I have a little problem:

I have a native method with the follow signature:

public native int enroll(byte[] template);

now I have it type data in C:

typedef unsigned charFPIMAGE;/* fp image data object */

Implementing my native method i need to call a function of a library to proccess this image(in this case the byte[]) but the signature of this method is:

FPCODE *cA = bd_fpCode(FPIMAGE *A, int xh, int yw, FPCODE *buf, int*qval);

A = pointer to the fingerprint image pixel matrix

xh = number of rows (height)

yw = number of columns (width)

buf = pointer to an external buffer with minimum size of FPC_MAXLEN bytes as destination for the created fingerprint code

qval = fingerprint image quality value (in %)

cA = pointer to fp-code (cA == buf) or NULL, if processing failed

There is my problem i don't now how to pass o convert my byte[] template to a object FPIMAGE.

you can help me please!

[1064 byte] By [woodstock2@a] at [2007-10-3 9:14:14]
# 1

Hi,

bd_fpCode() function is a 3rd party library, right ?

You can use a JNI wapper to do that, so you do not have to write C code.

Look at http://jnative.free.fr/SPIP-v1-8-3/article.php3?id_article=4 how to pass pointers to your functions and how to handle structures.

Alternatively, you can use env->GetByteArrayElements() in your own JNI wrapper lib see (http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jnistring.html).

--Marc (http://jnative.sf.net)

Message was edited by:

mdenty

mdentya at 2007-7-15 4:26:44 > top of Java-index,Java HotSpot Virtual Machine,Specifications...