Here you can find the source of fileToString(InputStream inputStream)
public static String fileToString(InputStream inputStream)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.stream.Collectors; public class Main { public static String fileToString(InputStream inputStream) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); return bufferedReader.lines().collect(Collectors.joining(System.lineSeparator())); }/*from w ww .j av a 2s . c o m*/ }