Created
October 22, 2009 03:43
-
-
Save ikai/215717 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
private byte[] getByteArrayFromInputStream(InputStream stream) throws IOException { | |
byte[] bytes; | |
int len; | |
byte[] buffer = new byte[8192]; | |
ByteArrayOutputStream output = new ByteArrayOutputStream(); | |
try { | |
while ((len = stream.read(buffer, 0, buffer.length)) != -1) output.write(buffer, 0, len); | |
bytes = output.toByteArray(); | |
} finally { | |
output.close(); | |
} | |
return bytes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment