• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

binary to ascii

 
Peter Straw
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic