title: Writing to S3 File stream
body: <p>I have a HttpURLConnection connection object to s3 file and I am writing to the connection stream as follows. It works for plain text ,zip files. But when I write a tar.gz file , after complete when I check the uploaded file. It is corrupted. </p>
  
  <p>I did binary compare some characters looks to be different. What can be the reason for some characters getting changed?</p>
  
  <pre><code>     URL s3FileUrl = new URL(s3Fileurl);
       HttpURLConnection connection=(HttpURLConnection) s3FileUrl.openConnection();
       connection.setDoOutput(true);
       connection.setRequestMethod("PUT");
       OutputStreamWriter out = new OutputStreamWriter(
                   connection.getOutputStream());
  
        FileInputStream fIn =  new FileInputStream("somefile");
          int i;
           while ((i = fIn.read()) != -1)
           {
               out.write(i);
           }
  
         fIn.close();
         out.close();
  </code></pre>