aspose file tools*
The moose likes Java in General and the fly likes binary to ascii Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "binary to ascii" Watch "binary to ascii" New topic
Author

binary to ascii

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
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.
John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130
Peter,

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 ]
 
Consider Paul's rocket mass heater.
 
subject: binary to ascii