Convert Stream to String with Java

On March 29, 2013, in Java, Programming, by LuCuS

Convert stream to string with Java.

	public static String convertStreamToString(InputStream is)
	{
	    Scanner s = new Scanner(is).useDelimiter("\\A");
	    String output = s.hasNext() ? s.next() : "";
	    s.close();
	    return output;
	}

Thank you for your interest in my site. If you find the information provided on this site useful, please consider making a donation to help continue development!

PayPal will open in a new tab.
$2.00
$5.00
Other

Related Posts

Tagged with:  

Leave a Reply