Questions tagged [jbytearray]

7 questions
3
votes
0 answers

JNI C++ -> Java bitmap header info and bytes to jbytearray

I'm using JNI to pass an image from C++ to Java, im trying to send the bytes in a jbyteArray over to Java in byte[]. However I'm getting an error which has most likely have to do something with the size of the bytes being send. I have tried int len…
MicroHat11
  • 227
  • 3
  • 12
1
vote
1 answer

How to transfer encrypt data from c++ to java

I've a simple encryption program using JNI(JAVA , C++ . Briefly : I pass a simple string into c++ program. C++ program encrypts that string for me and return cipher string. I'll print ciphertext for a client. Problem : When I encrypt in c++ and…
1
vote
1 answer

Sending jbyte array to Java method failed using JNI

Consider this java method: public int write(byte[] src, int timeoutMillis) throws IOException { System.out.println("Write function started."); System.out.println("buffer = " + src.length); System.out.println("buffer = " + src[0]); …
a.toraby
  • 3,232
  • 5
  • 41
  • 73
0
votes
1 answer

How to convert ArrayList to vector for JNI?

I want to convert ArrayList in java to vector in c++. How can I do this? Input: jobject input in c++, which is ArrayList in JAVA. Output: class named vector in c++; //Find jclass 4 ArrayList, just test jposCommits and jnegCommits are instances of…
Felix LL
  • 133
  • 4
0
votes
1 answer

I'm trying to modify a byte array and send it from c++ to java via the JNI

This is my function: void FrameReceived(int width, int height, const char *rawImageBytes, int size, jboolean remote) { if(size == 0) return; jboolean isAttached; JNIEnv *env; jint jParticipant; jint jWidth; jint jHeight; jbyte…
rosu alin
  • 5,674
  • 11
  • 69
  • 150
-1
votes
1 answer

How to write jbyteArray( or byte array) to txt file c++?

I have an image in a form that jbytearray in c++. I need to write it to txt file. I did many solutions on stackoverflow but none of them worked for me. when I cast jbyteArray into char *, it is successfully write it, but i need to write it as a…
ozer
  • 241
  • 2
  • 12
-1
votes
1 answer

Convert between unsigned char array to jbytearray and data loss

I want to convert unsigned char array to jbytearray and jbytearray to unsigned char array. Here is what I want to do: phase 1) unsigned char data1[] to jbytearray in jni. jbytearray to byte[] in java base 64 encoding byte[] to String and save in…
oldman77
  • 19
  • 4