Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static StringBuffer readInputStream(InputStream inputStream) throws IOException { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8"); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); StringBuffer requestXml = new StringBuffer(); String line; while (null != (line = bufferedReader.readLine())) { requestXml.append(line).append(System.getProperty("line.separator")); } bufferedReader.close(); inputStreamReader.close(); return requestXml; } }