Re: Binary to ASCII Question
From: Marco Schmidt (marcoschmidt_at_geocities.com)
Date: 10/23/03
- Next message: Larry Coon: "Re: Controlling where JDialog opens"
- Previous message: Mark McIntyre: "Re: approx 100 assorted computer/ math/other books"
- In reply to: dog: "Binary to ASCII Question"
- Next in thread: dog: "Re: Binary to ASCII Question"
- Reply: dog: "Re: Binary to ASCII Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 23 Oct 2003 23:15:43 +0200
dog:
[...]
>Really just wondering. I would think it would translate each byte to the
>unicode equal which is what I am trying to do. Okay that didn't work, but
>what did it do? Anyeasy way to go from a JPG to unicode?
>Do I add 128 to all the byte value of just knock of the sign? Or niether?
Not sure what you are trying to accomplish here. Why would you want to
convert the binary data of a JPEG file to a character stream?
You can convert bytes to int values in the interval 0..255 by using
the & operator:
byte b = ...;
int i = b & 0xff;
Same with char:
char c = b & 0xff;
If you really use the String constructor, some of the original bytes
may get converted to other values because the default character
encoding of the JVM running may require a conversion.
The question remains: Why do you want the binary data as a character
array or String?
Regards,
Marco
-- Please reply in the newsgroup, not by email! Java programming tips: http://jiu.sourceforge.net/javatips.html Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html
- Next message: Larry Coon: "Re: Controlling where JDialog opens"
- Previous message: Mark McIntyre: "Re: approx 100 assorted computer/ math/other books"
- In reply to: dog: "Binary to ASCII Question"
- Next in thread: dog: "Re: Binary to ASCII Question"
- Reply: dog: "Re: Binary to ASCII Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|