Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > converting jbytearray to unsigned char array

Reply
Thread Tools

converting jbytearray to unsigned char array

 
 
marydeepthy@gmail.com
Guest
Posts: n/a
 
      08-17-2005
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...

 
Reply With Quote
 
 
 
 
Joan
Guest
Posts: n/a
 
      08-17-2005

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.

 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      08-17-2005
On 16 Aug 2005 21:49:13 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-17-2005
On 17 Aug 2005 08:52:32 +0200, Gordon Beaton <(E-Mail Removed)> 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
 
Reply With Quote
 
Boudewijn Dijkstra
Guest
Posts: n/a
 
      08-18-2005
"Roedy Green" <(E-Mail Removed)> schreef in bericht
news(E-Mail Removed)...
> On 17 Aug 2005 08:52:32 +0200, Gordon Beaton <(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Unsigned char array to an unsigned longlong array Gabriel Genellina Python 0 08-13-2009 09:28 AM
Casting from const pair<const unsigned char*, size_t>* to constpair<unsigned char*, size_t>* Alex Vinokur C++ 9 10-13-2008 05:05 PM
Converting a unsigned char * to const char * hamishd C++ 12 08-05-2007 02:56 AM
Linking error LNK2001 - "__declspec(dllimport) private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Tidy(unsigned short)" (__imp_?_Tidy@?$basic_string@DU?$char_ sharmadeep1980@gmail.com C++ 1 07-07-2006 07:27 AM
void*, char*, unsigned char*, signed char* Steffen Fiksdal C Programming 1 05-09-2005 02:33 AM



Advertisments