Here you can find the source of InputStreamFromString(String str)
public static InputStream InputStreamFromString(String str)
//package com.java2s; //License from project: Apache License import java.io.ByteArrayInputStream; import java.io.InputStream; public class Main { private static final String ENCODING = "UTF8"; public static InputStream InputStreamFromString(String str) { byte[] bytes = null; ByteArrayInputStream thisInputStream = null; try {/*w w w . j av a 2 s. co m*/ bytes = str.getBytes(ENCODING); thisInputStream = new ByteArrayInputStream(bytes); } catch (Exception e) { } return thisInputStream; } }