title: Converting input stream containing multipart form data to string in java
body: <p>I have http response object &quot;httpResponse&quot; which is instance of class javax.ws.rs.core.Response. I have to convert it into a human readable string object for debugging. How can I achieve this?</p>
  <pre><code>final InputStream inputStream = (InputStream) httpResponse.getEntity();
  final ByteArrayDataSource dataSource = new ByteArrayDataSource(inputStream, ContentType.MULTIPART_FORM_DATA.getMimeType());
  final MimeMultipart multipartResponse = new MimeMultipart(dataSource);
  </code></pre>
  <p>I tried doing the below using the inputStream object. The output is all binary. Do I need to do base64 decoding? Thanks.</p>
  <p>IOUtils.toString(inputStream, StandardCharsets.UTF_8))</p>