Java tutorial
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; public class Main { public static InputStream getStringStream(String sInputString) throws UnsupportedEncodingException { ByteArrayInputStream tInputStringStream = null; if (sInputString != null && !sInputString.trim().equals("")) { tInputStringStream = new ByteArrayInputStream(sInputString.getBytes("UTF-8")); } return tInputStringStream; } }