title: converting byte stream in HTTPResponse body into a pdf file
body: <p>When i hit an API through postman i am able to download a pdf file.
  When i hit the same API through java code i get pdf content in ResponseBody.
  And i am able to create a new pdf file with the responsebody content but when i open the file it is blank.</p>
  
  <p>my question is how can i create a new file with the same content as in response.</p>
  
  <p>i tried the foll. code to convert the response </p>
  
  <pre><code>file  = new File("/home/abc.pdf");
              outputStream = new BufferedOutputStream(new FileOutputStream(file));
              if (!file.exists()) {
                  file.createNewFile();
              }
  
              byte[] contentInBytes = response.getBody().getBytes();
              System.out.println(Arrays.toString(contentInBytes));
  
              outputStream.write(contentInBytes);
              outputStream.flush();
              outputStream.close();
  </code></pre>