Sunday, January 16, 2011

Creating a Download Manager in Java

Hello folks, I am back here again...!
Being a Java fanboy, I keep myself indulged with writing some sort of applications or code snippets in Java in my leisurely time. During last few months I have been working on this Java download manager...Its nothing but a simple program having lots of classes and files etc.

Java Swing download manager
But most importantly, there are many threads of program execution.This download manager is not a kind of some professional software, its simply a single segmented multi-threaded download manager. Multi-threading being one of my programming manias as foretold on my About Me page. The whole download manager is based on  just a following Classes in Java. Though I have added some more classes to create the Software Application user interface(UI) in Java.

Creating an URL object
Getting URLConnection object from URL object
Getting InputStream object from URLConnection object
Then reading the InputStream as usual

/*A simple algorithm to read and write the downloaded  file to the local disk.*/
  FileOutputStream fos;
  InputStream is;
   while(is.read()!=EOF)
      {
           fos.write();
       }

   With the above code the file located at a specific URL is downloaded and saved to the local disk. I have packed the whole simple read-write program into Java Swing desktop Application. This way I also got to learn a little bit of a Java Swing API.

  The following screen-shot depicts the program activity on the console or command prompt.
Console Output


I believe and assure that this is a software written just out of interest, but your comments and criticisms are always welcome anywhere on The4thdimension.

10 comments:

  1. but i need to down load file from database.if any one help on this.....

    ReplyDelete
  2. I want the src code please if possibse

    ReplyDelete
  3. Sorry, I did not publish the code. I had built it back in 2011, had the source code for a while. Did not know ways to share it online back then. And now I lost it. I think the explanation about it should give you an idea.

    ReplyDelete

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Share This

Share |