The main problem might be your file encoding. You should use the correct encoding (probably UTF-8) , e.g.:
byte[] b = "The data i want".getBytes("UTF-8");
file.write(b);
Note that if you're using a text viewer/editor to check the file, depending on which one you're using you might have to write a UTF-8 byte order mark at the beginning of the file or tell the viewer/editor to use UTF-8 if it can't figure it out by itself.