Here you can find the source of String2InputStream(String str)
public static InputStream String2InputStream(String str)
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; public class Main { public static InputStream String2InputStream(String str) { ByteArrayInputStream stream = null; try {//from w w w. j a va 2 s . c o m stream = new ByteArrayInputStream(str.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return stream; } }