Read InputStream fully to a string
//package org.anddev.andengine.util; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Writer; import java.util.Scanner; /** * (c) 2010 Nicolas Gramlich * (c) 2011 Zynga Inc. * * @author Nicolas Gramlich * @since 15:48:56 - 03.09.2009 */ class StreamUtils { public static final int IO_BUFFER_SIZE = 8 * 1024; public static final String readFully(final InputStream pInputStream) throws IOException { final StringBuilder sb = new StringBuilder(); final Scanner sc = new Scanner(pInputStream); while(sc.hasNextLine()) { sb.append(sc.nextLine()); } return sb.toString(); } }