converting jbytearray to unsigned char array

Discussion in 'Java' started by marydeepthy@gmail.com, Aug 17, 2005.

  1. Guest

    Hi,

    i have a native method, as folowws:

    JNIEXPORT jobjectArray JNICALL l2cap_L2CAPImpl_L2CAOpen
    (JNIEnv *env, jobject obj, jbyteArray dev, jstring service, jboolean
    auth, jboolean crypt)
    {
    unsigned char address[6];

    }


    the value of address is the same as jbyteArray dev, which is passed
    from the java program. i have to convert the jbytearray to this char
    array. how can i do this. i am completely new to JNI and this native
    calls are only a small part of my big project..so please do help me...
    , Aug 17, 2005
    #1
    1. Advertising

  2. Joan Guest

    <> wrote in message
    news:...
    > Hi,
    >
    > i have a native method, as folowws:
    >
    > JNIEXPORT jobjectArray JNICALL l2cap_L2CAPImpl_L2CAOpen
    > (JNIEnv *env, jobject obj, jbyteArray dev, jstring service,
    > jboolean
    > auth, jboolean crypt)
    > {
    > unsigned char address[6];
    >
    > }
    >
    >
    > the value of address is the same as jbyteArray dev, which is
    > passed
    > from the java program. i have to convert the jbytearray to this
    > char
    > array. how can i do this. i am completely new to JNI and this
    > native
    > calls are only a small part of my big project..so please do
    > help me...
    >

    SUN has a tutorial on this, take a look.
    Joan, Aug 17, 2005
    #2
    1. Advertising

  3. On 16 Aug 2005 21:49:13 -0700, wrote:
    > i have to convert the jbytearray to this char array. how can i do
    > this.


    GetByteArrayElements() and (important!) ReleaseByteArrayElements().

    These and other functions are described in the Array Operations
    section of the JNI spec.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Aug 17, 2005
    #3
  4. Roedy Green Guest

    On 17 Aug 2005 08:52:32 +0200, Gordon Beaton <> wrote or
    quoted :

    >These and other functions are described in the Array Operations
    >section of the JNI spec.


    I suggest getting a text book to explain these. Understanding them
    from the raw spec are for the types who like to eat nails for
    breakfast.

    See http://mindprod.com/jgloss/jni.html
    Roedy Green, Aug 17, 2005
    #4
  5. "Roedy Green" <> schreef in bericht
    news:eek:...
    > On 17 Aug 2005 08:52:32 +0200, Gordon Beaton <> wrote or
    > quoted :
    >
    >>These and other functions are described in the Array Operations
    >>section of the JNI spec.

    >
    > I suggest getting a text book to explain these. Understanding them
    > from the raw spec are for the types who like to eat nails for
    > breakfast.


    Hmm, sounds like I should try eating nails for breakfast.
    Boudewijn Dijkstra, Aug 18, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steffen Fiksdal

    void*, char*, unsigned char*, signed char*

    Steffen Fiksdal, May 8, 2005, in forum: C Programming
    Replies:
    1
    Views:
    577
    Jack Klein
    May 9, 2005
  2. hamishd
    Replies:
    12
    Views:
    5,006
  3. Ioannis Vranos
    Replies:
    11
    Views:
    757
    Ioannis Vranos
    Mar 28, 2008
  4. Alex Vinokur
    Replies:
    9
    Views:
    784
    James Kanze
    Oct 13, 2008
  5. Gabriel Genellina
    Replies:
    0
    Views:
    512
    Gabriel Genellina
    Aug 13, 2009
Loading...

Share This Page