utils/src/main/java/org/robolectric/util/Util.java
public static byte[] readBytes(InputStream is) throws IOException {
    try (ByteArrayOutputStream bos = new ByteArrayOutputStream(is.available())) {
      copy(is, bos);
      return bos.toByteArray();
    }
  }
public static byte[] readBytes(InputStream is) throws IOException {
    try (ByteArrayOutputStream bos = new ByteArrayOutputStream(is.available())) {
      copy(is, bos);
      return bos.toByteArray();
    }
  }
public static byte [ ] readBytes ( InputStream is ) throws IOException { try ( ByteArrayOutputStream bos = new ByteArrayOutputStream ( is . available ( ) ) ) { copy ( is , bos ) ; return bos . toByteArray ( ) ; } }
This method consumes an input stream and returns its content.

@param is The input stream to read from.
@return The bytes read from the stream.
@throws IOException Error reading from stream.
This method consumes an input stream and returns its content .