title: File size from URL not the same as download file in storage
body: <p>I am trying to download a file from a URL  using an Asynctask. In the doInBackground() method, I retrieve the file size, like this.</p>
  
  <pre><code>    lenghtOfFile = conection.getContentLength();
  </code></pre>
  
  <p>This returns an integer value. Now, the download continues and file is completely downloaded and written to sdcard.</p>
  
  <p>The problem is that in my postExecute() I want to compare the size of the file from the URL and the size of the file downloaded.</p>
  
  <pre><code>    @Override
      protected void onPostExecute(String s) {
          super.onPostExecute(s);
  
          //check if the file was download and know how much of it
          //was downloaded, so as to update ui accordingly
          if(file.exists()){
  
              Log.e("apiFileSize", String.valueOf(lenghtOfFile));
              Log.e("downloadFileSize", String.valueOf(file.length()));
  
              //check if the file was completely downloaded
              if(lenghtOfFile == file.length()){
                       ....
  </code></pre>
  
  <p>As you can see I log both values, but they are not equal even though the download ran to its end and the file was fully downloaded. The file from local storage(sdcard) ends up being greater than the file size from the url. I expect them to be equal, why is this happening? what can I do?</p>
  
  <p>Below is the log result.</p>
  
  <pre><code>09-23 22:44:48.203  26594-26594/com.mobile.soullounge E/apiFileSize﹕ 1298573 
  09-23 22:44:48.204  26594-26594/com.mobile.soullounge E/downloadedFileSize﹕ 2696392
  </code></pre>
  
  <p>Thanks in advance.</p>