I want to convert a plain text string to binary data so that the readable text is no longer visible, however certain programs can interpret the binary data properly.
Something like when we compile a program into a class, the code is no longer readable, but JVM can still read it.
I'm not making a compiler of some kind, just need to convert text to binary data, then write this data to a file.
Please tell me how to do this.
The easiest way is to convert each character to a hexadecimal representation of the original text, and write that to disc. The only downside to this is that the size doubles. IE, 10 characters of input data will result in 20 characters of output data. To read it back, you read 2 characters at a time, and then convert that to an integer value, cast to a char, and append that to a string. The actual coding for this I leave to you. Once you make an effort to code it, we will be happy to help with any problems you may have.
Encryption and hex may not work in this case, because the program that "re-reads" the data is a third party tool and I cannot change its code to match my encryption.
I know it can process binary data, so I'm trying for binary output.
I got a string, which gets converted to binary data and then written to a file. This is all I need.
Please post some code.
Almost all programs read binary data, but it's not all the same binary data and they don't all use it in the same way. No matter how you generate the binary data it may not work in this case because the program needs some specific binary data to do what you want it to do.
Unless you explain more about the program that processes the binary data and what you expect it to do with the binary data, there is no hope of anyone being able to really help you.