Re: how to communicate unsigned char* to Java
- From: "Günter Prossliner" <g.prossliner/gmx/at>
- Date: Tue, 22 May 2007 17:18:54 +0200
Hi
Well! why don't you just write it with char* and read it via
java string.
This will not work, allthough it _may_ work on some bunch of data.
Because: Strings in Java are Unicode (aka UTF-16). An not every sequence of
bytes is valid Unicode. Unicode Implementations may substitute the illegal
chars with something else, or throw an error.
Now write some funny code to elaborate those strings to
meaningful values;-)
Converting random binary data into a Unicode-String and converting this
Unicode-String back to binary data will not produce the same data again in
many cases.
While in a "none-unicode" world Strings could be used to carry some binary
data (allthough it was never a good coding practice), these techniques will
not work propery when you have unicode DataTypes and Parsers.
You just have to use the byte - Datatype to read arbitary binary data in
Java.
GP
.
- Follow-Ups:
- Re: how to communicate unsigned char* to Java
- From: Ali
- Re: how to communicate unsigned char* to Java
- From: Alexander Nickolov
- Re: how to communicate unsigned char* to Java
- References:
- Re: how to communicate unsigned char* to Java
- From: Alexander Nickolov
- Re: how to communicate unsigned char* to Java
- From: Ananya
- Re: how to communicate unsigned char* to Java
- From: Ali
- Re: how to communicate unsigned char* to Java
- Prev by Date: Re: CAsyncSocket OnReceive() never called
- Next by Date: Re: how to communicate unsigned char* to Java
- Previous by thread: Re: how to communicate unsigned char* to Java
- Next by thread: Re: how to communicate unsigned char* to Java
- Index(es):
Relevant Pages
|