Here you can find the source of getFileContent(InputStream is)
public static String getFileContent(InputStream is) throws IOException
//package com.java2s; /*L/*from w w w .j a v a 2 s . c o m*/ * Copyright Oracle Inc, SAIC-F. * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cadsr-bulk-loader/LICENSE.txt for details. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { /** * There is a much cleaner implementation of doing this, but good * enough since it is only used for testing */ public static String getFileContent(InputStream is) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; StringBuffer buff = new StringBuffer(); while ((line = br.readLine()) != null) { buff.append(line + "\n"); } return buff.toString(); } }