views:

46

answers:

0

I'm creating a simple download manager in java and I want to be able to download files from rapidshare as a premium user. I checked their API, but that didn't make me any wiser. I found this class in C, but I have no idea how use it with my downloader.

 public void Download() {

  try {

   URL url  = new URL(this.FileLink);
   // Copy resource to local file, use remote file
   // if no local file name specified
   InputStream is = url.openStream();
   FileOutputStream fos = new FileOutputStream(this.GetLocalFile(url.getFile()));
   int SingleByte;
   while ((SingleByte=is.read()) != -1) {

    fos.write(SingleByte);

   }
   is.close();
   fos.close();

  } catch (MalformedURLException e) {
   System.err.println(e.toString());
  } catch (IOException e) {
   System.err.println(e.toString());
  }
 }