0

Here is my C method:

unsigned char *pixel = GetTheCamPixel();

//Do something to convert it to string
//Send this string to a java client

After my Java client received the string, I would like to convert it back to a Java unsigned char array:

String sReceive = this.receiveFromC();
//Do something to make a unsigned char array

How can I do this?

alk
  • 69,737
  • 10
  • 105
  • 255
DNB5brims
  • 29,344
  • 50
  • 131
  • 195
  • Are you using any sort of library for this? – nanofarad Aug 21 '13 at 06:28
  • What are you trying to accomplish? A precise translation isn't possible, but there are a few useful options. – chrylis -cautiouslyoptimistic- Aug 21 '13 at 06:29
  • @hexafraction I use `com.google.common.io` to transfer this string. Beside from that, I don't have another third party library. @chrlyis I want to transfer my unsigned char array to my java server. – DNB5brims Aug 21 '13 at 06:33
  • possible duplicate of [Problem converting C/C++ unsigned char to JAVA](http://stackoverflow.com/questions/3630979/problem-converting-c-c-unsigned-char-to-java) – Vineet1982 Aug 21 '13 at 09:40
  • Your `char*` here is actually a binary string, not text. You can convert it into a `byte[]` but converting it into a text String is unlikely to be a good idea, and is likely to mangle your data because it is not text. – Peter Lawrey Aug 21 '13 at 10:04

0 Answers0