code: public static byte[] readBytes(InputStream is) throws IOException {
      try (ByteArrayOutputStream bos = new ByteArrayOutputStream(is.available())) {
        copy(is, bos);
        return bos.toByteArray();
      }
    }
docs: 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.