Binary data is not text data, much less necessarily ASCII data - so there is no conversion that will work in general. What may work is to base-64 encode the data; the Apache Commons Codec library can help with that.
I want convert binary data from the source file to ascii file. Because i want to load data into database.
Ascii is the user friendly data type, so i want conver the data to ascii format before loading into the database.
Please give me the best suggestion to do this.
And what is the use of base64 encoding. Is it gives the result as ascii format.
Actually i tried with base64, The starting variable as follows
private static final String base64code = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + /";
private static final int splitLinesAt = 76;
But when i run this code it is giving different output than what i am expecting.
Any way i will try with your suggestion
Joined: Mar 22, 2005
sankar dunga wrote:But when i run this code it is giving different output than what i am expecting.
We might be able to help with this if a) we knew what output you got, and b) what output you were expecting. Seeing the actual code you used to base-64 encode the data -and to output it- would also help.