This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
Please can you tell me the easiest way to convert a binary data from a file into ascii. I understand how to read the file using InputStream but am having difficulty converting the bytes to ascii. Many thanks.
posted 9 years ago
First of all I think we need to confirm some terminology. When you talk about conversion of binary data to ascii, do you really mean converting a byte stream to characters?
If so, then you should probably look at the InputStreamReader class. If the byte stream you are reading uses a default character encoding, then you may consider using the FileReader class. If your byte stream uses an encoding different from the default encoding, then you would probably need to use an InputStreamReader in conjunction with a FileInputStream.
If you could provide some more details on what you're doing together with any code you have we would have a better of chance of helping you out further.
Regards, JD [ August 03, 2006: Message edited by: John Dell'Oso ]