简体   繁体   中英

How to pass JPEG from JAVA to C in Android

I need send JPEG data to C executable process and return some data from that C process back to JAVA part within Android on non root phone. What could be the best solution ? I heard about pipes. I use IPC with TCP and sockets now, but sockets randomly stuck. Part of my IPC is in JNI too, but I would like don't use JNI again. My C process is started from Java by command Runtime.getRuntime().exec(command)

I think that this code from Peter Knego could be useful, but it is not complete and he didn't provide C part.

String command = "ls";
Process child = Runtime.getRuntime().exec(command);

// Get pipes from process
InputStream in = child.getInputStream();
OutputStream out = child.getOutputStream();
InputStream error = child.getErrorStream();

thanks. you can try use the native method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM