If you want to convert a String into InputStream, you can use the following piece of code.
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class ConvertStringToInputStream {
public static void main(String[] args) {
try {
// Convert the String into InputStream
String eurekaUrl = "https://ykyuen.wordpress.com";
InputStream is = new ByteArrayInputStream(eurekaUrl.getBytes("UTF-8"));
// Use Apache Commons IO to get the content of the InputStream
System.out.println(IOUtils.toString(is, "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
}