My background is .net, I’m fairly new to Java. I’m doing some work for our company’s java team and the architect needs me to implement a method that takes an InputStream (java.io) object. In order to fulfill the method’s purpose I need to convert that into a byte array. Is there an easy way to do this?
Share
The simplest way is to create a new
ByteArrayOutputStream, copy the bytes to that, and then calltoByteArray: