Created
January 27, 2019 14:37
-
-
Save tachesimazzoca/482491b4015890a366f1e77cef088a60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IOUtils { | |
public static String toString(InputStream input, String charset) throws IOException { | |
ByteArrayOutputStream output = new ByteArrayOutputStream(); | |
byte[] buffer = new byte[1024]; | |
int n = 0; | |
while ((n = input.read(buffer)) != -1) { | |
output.write(buffer, 0, n); | |
} | |
return output.toString(charset); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment