char in
Java is 2-byte (Unicode). For binary files (such as most photos formats) you need 1-byte values, so the need to convert it to byte, not char.
(And don't use any Readers or Writers for binary files.)
Converting int to byte can be done using typecasting (in this case).
EDIT: To output the bytes correctly use OutputStream's write(int) method, PrintStream's print(char) may convert it incorrectly. You don't need to convert that int to anything since write method already accepts int.
EDIT: I tried it with
and it works.
prints only ?.
[ April 21, 2006: Message edited by: Vlado Zajac ]
[ April 21, 2006: Message edited by: Vlado Zajac ]
[ April 21, 2006: Message edited by: Vlado Zajac ]