String source = "This is the source of my input stream"; InputStream in = org.apache.commons.io.IOUtils.toInputStream(source, "UTF-8");