Java Desktop file download -


while making desktop application,i want able download video file server , save in client's pc. how it?i have no idea. tools use?please guide looking forward kind of integrated ftp thing.i not clear how work.

where wanna download file? direct url or youtube like?

something that:

public class downloadtofile {     private url from;     private string to;      public downloadtofile(url url, string path_to)     {         this.url = url;         this.to = path_to;     }      public downloadtofile(string url, string path_to)     {         try         {             this.url = new url(url);         }         catch(malformedurlexception e)         {             e.printstacktrace();         }          this.to = path_to;     }      public void savefile() throws ioexception      {         bufferedinputstream in = new bufferedinputstream(this.from.openstream());         fileoutputstream out = new fileoutputstream(this.to);             try              {                 final byte data[] = new byte[1024];                     int count;                         while ((count = in.read(data, 0, 1024)) != -1)                         {                             out.write(data, 0, count);                         }             }                         {                 if (in != null)                 {                     in.close();                 }         if (fout != null)         {             fout.close();         }     } } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -