Here you can find the source of toInputStream(String s, String charSet)
public static InputStream toInputStream(String s, String charSet) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static InputStream toInputStream(String s, String charSet) throws IOException { return new ByteArrayInputStream(s.getBytes(charSet)); }/* ww w.j a va 2s.com*/ }