title: How to get file stream in Android? (download manager)
body: <p>I'm doing a project which is similar to the Download Manager.</p>
  
  <p>One of the functions is to allow the user to pause the file so they can resume the download later. I have Googled it, but unluckily still haven't solved the problem (maybe I'm new in android and stupid to solve it).</p>
  
  <p>The question is... If one of the files hasn't finish the download, how do I get the current stream / size of the file? And how can I continue to write the file?</p>
  
  <p>I have seen a code in java as below:</p>
  
  <pre><code>begin = downloaded;
  file = (FileConnection) Connector.open("\sdcard\abc.mp3");
  OutputStream output = file.openOutputStream(begin);
  DataOutputStream dos = new DataOutputStream(output);
  if(read != -1) {
  dos.write(buffer, 0, read);
  dos.flush();
      downloaded += read;
  }
  </code></pre>
  
  <p>But I don't really understand how it works in android :(
  Your reply is very appreciated!!!</p>
  
  <p>P/S: I'm sorry about my bad English, hope you guys understand what I'm talking about.
  Thank you.</p>
  
  <p>Regard</p>