private static String changeInputStream(InputStream inputStream, String encode) { // TODO Auto-generated method stub // 将InputStream转换为Reader,并使用缓冲读取,提高效率,同时可 // 以按行读取内容 BufferedReader br; String result = null; try { br = new BufferedReader(new InputStreamReader(inputStream, encode)); String line = null; while ((line = br.readLine()) != null) { result += line; } inputStream.close(); return result; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ""; }
Done!