InputStream targetStream = new ByteArrayInputStream("your string".getBytes());
// Creates an InputStream InputStream object1 = new FileInputStream();