//String2InputStream private InputStream String2InputStream(String str){ ByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes()); return stream; } //inputStream2String private String inputStream2String(InputStream is){ BufferedReader in = new BufferedReader(new InputStreamReader(is)); StringBuffer buffer = new StringBuffer(); String line = ""; try { while ((line = in.readLine()) != null){ buffer.append(line); } } catch (IOException e) { e.printStackTrace(); } return buffer.toString(); }