• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

convert Binary file to a text file

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to read a binary file & convert it into a text file
The binary file can contain both numbers & alphabets..
can someone provide a sample code that will help me in doing this..

thanks
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
If you have the exact structure of your file, you might want to look at DataInputStream!
Hope this helps!
Abhik.
 
ravicnew kumar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i don't know the structure of the file...one thing i know is that it will be always a file generated from Test & numbers.. what i mean is that it won't be any image file or something.
the text & number data in the binary format can be changing..
even if the text was not changing who will i know when to use a readInt or when to use a readByte or something...
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're not going to be able to interpret a binary file without knowing its *EXACT* data structure before hand. There is no way to infer the data type of an arbitrary group of bytes.
Ever wonder what the fuss about xml was about? XML makes this type of thing trivial, you just look for the correct element tags and extract the needed data.
Michael Crutcher
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic