Here you can find the source of StringTOInputStream(String in, String encoding)
public static InputStream StringTOInputStream(String in, String encoding)
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; public class Main { public static InputStream StringTOInputStream(String in, String encoding) { try {/* w w w . j ava2 s. c o m*/ ByteArrayInputStream is = new ByteArrayInputStream( in.getBytes("ISO-8859-1")); return is; } catch (UnsupportedEncodingException e) { return null; } } }