Here you can find the source of toInputStream(String input)
public static InputStream toInputStream(String input)
//package com.java2s; //License from project: Apache License import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static InputStream toInputStream(String input) { byte[] bytes = input.getBytes(); return new ByteArrayInputStream(bytes); }/*from ww w . ja v a 2s . co m*/ public static InputStream toInputStream(String input, String encoding) throws IOException { byte[] bytes = (encoding != null) ? input.getBytes(encoding) : input.getBytes(); return new ByteArrayInputStream(bytes); } }