Don't use String
/char
when handling binary data. Use byte[]
/byte
instead. Fix that before you try to fix any other bugs.
char
is a 16-bit value in Java, it's not the same as the C char
(which is defined to be a byte). The closest thing to a C char
in Java is the byte
(which is signed, 'though).
Joachim Sauer
2009-04-06 10:55:48