How do I read an entire InputStream into a byte array?
InputStream
You can try Cactoos:
byte[] array = new BytesOf(stream).bytes();