title: Pause download in Java?
body: <p>I'm using this code to download a file, and I was wondering if its possible to pause the download and then resume it later, and if so how?:  </p>
  
  <pre><code>    URL url = new URL(URL);
          URLConnection conexion = url.openConnection();
  
          conexion.connect();
          int lenghtOfFile = conexion.getContentLength();
          lenghtOfFile /= 100;
  
          InputStream input = new BufferedInputStream(url.openStream());
          OutputStream output = new FileOutputStream(Path + FileName);
  
          byte data[] = new byte[1024];
          long total = 0;
  
          int count = 0;
          while ((count = input.read(data)) != -1) {
              output.write(data, 0, count);
              total += count;
          }
  
          output.flush();
          output.close();
          input.close();
  </code></pre>