Here you can find the source of readToString(final InputStream inputStream)
public static String readToString(final InputStream inputStream)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.io.InputStream; import java.util.Scanner; public class Main { public static String readToString(final InputStream inputStream) { return new Scanner(inputStream).useDelimiter("\\A").next(); }/* w w w . ja v a2 s . c o m*/ }