Java tutorial
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.UnsupportedEncodingException; public class Main { private static InputStream String2Inputstream(String str) throws UnsupportedEncodingException { return new ByteArrayInputStream(str.getBytes("utf-8")); } }