Most efficient way to write a string to a file

file, java, output, text

Solution

Use FileWriter will do you job.

BufferedWriter writer = new BufferedWriter( new FileWriter( yourfilename));
writer.write( yourstring);
// do stuff 
writer.close();

Problem

Possible Duplicate: How do I save a String to a text file using Java? I want to add a reading from a machine to a file (Java). The reading will be in the form of a string that I have formatted. The file is just a text file. At the moment I am considering Filewriter/Buffered writer is this the correct one to use?

Original source

Related problems