Monday, December 12, 2011

Converting a File to a String, then converting it to binary?

Okay, I'm planning on making a small compression program. I know how to open a file. I use JFileChooser to open a file and save it to the File variable named file, but I want to be able to convert it to a String and convert a String into a File. How do I do this?


But then later I realized I should convert it to binary (ugh, I spent so much time working out an ascii compression code and now I realize doing binary compression is so much better...) How do I convert a string to binary and back?





This is in Java.|||The file is already binary so you don't need to do a thing. The only reason a text file displays as text is because it gets converted from binary to a text encoding type (such as ascii).





Read a file byte by byte using the class java.io.FileInputStream

No comments:

Post a Comment