In particular, getting an InputStream from a String:

InputStream source = new ByteArrayInputStream(myString.getBytes("UTF-8"));
IFile out = project.getFile(f + ".xml");
out.create(source, true, monitor);

This uses Eclipse’s IFiles to set the file contents.

The major problem is that InputStreams know nothing of character encoding, thus the deprecation to use StringReader instead. (ref)

To achieve this without using Eclipse’s framework, see this code.