If it is possible to convert character streams to byte streams into a file? Would you help me explaining it by means of a program?
Converting characters to bytes can be done with an OutputStreamWriter
(which writes to a FileOutputStream
) which handles translating the characters to bytes. Make sure you specify an encoding, otherwise it will use the platform default encoding and suddenly it won't work the same on all platforms anymore.
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("myfile.txt"), "UTF-8"));