title: java apache IOUtils breaks file content
body: <p>I need to encode/decode pdf file into Base64 format.
  So I read file from disk into String(because I will receive file in String Base64 format in future);</p>
  
  <pre><code>String pdfString = IOUtils.toString(new FileInputStream(new
              File("D:\\vrpStamped.pdf")));
  byte[] encoded = Base64.encodeBase64(pdfString.getBytes());
  
  byte[] newPdfArray = Base64.decodeBase64(encoded);
  FileOutputStream imageOutFile = new FileOutputStream(
          "D:\\1.pdf");
  imageOutFile.write(newPdfArray);
  imageOutFile.close();
  imageOutFile.flush();
  </code></pre>
  
  <p>So my <code>D:\\1.pdf</code> doesnt opens in AdobeReader, but if I read file straight to byte array,  using <code>IOUtils.toByteArray(..)</code> instead ,all works fine and my <code>D:\\1.pdf</code> file sucessfuly opens in Adobe Reader:</p>
  
  <pre><code>byte[] encoded = Base64.encodeBase64(IOUtils.toByteArray(new FileInputStream(new File("D:\\vrpStamped.pdf"))););
  </code></pre>
  
  <p>It seems to me thath <code>IOUtils.toString(..)</code> change something inside file content. So how can I convert file to String with not content breaking?</p>