Here you can find the source of createInput(String s, String charsetName)
public static InputStream createInput(String s, String charsetName)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.charset.Charset; public class Main { public static InputStream createInput(String s, String charsetName) { Charset cs = Charset.forName(charsetName); InputStream in = new ByteArrayInputStream(cs.encode(s).array()); return in; }/*from www . j a v a2 s. c o m*/ }