How do I read an entire InputStream into a byte array?
InputStream
If you happen to use google guava, it'll be as simple as :
byte[] bytes = ByteStreams.toByteArray(inputStream);