This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes How to implement file downloading functionality ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to implement file downloading functionality ?" Watch "How to implement file downloading functionality ?" New topic
Author

How to implement file downloading functionality ?

Ritesh Badwaik
Greenhorn

Joined: Feb 23, 2009
Posts: 16
Hi all,
I am developing a web application which provides very large data files(file size is equal to about 500 MB) for downloading.
Can anyone tell me, how to implement this ?
Also I want to know , what is FTP file downloading & HTTP file downloading ? Which one I should use ?




Regards
Ritesh
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

a few questions.
Are the files compressed already?
How much traffic are you expecting?
Have you looked into Amazon S3?

You will want to avoid loading the entire file into memory and then trying to send it. Instead, use streams.


This is a good thread about using streams for downloading large files. link

With FTP you will need a separate program on your sever, an FTP server. Your users will need an FTP client.
HTTP downloads allows your web server to do the job.

also read this post on handling large data files
Ritesh Badwaik
Greenhorn

Joined: Feb 23, 2009
Posts: 16
Hi,
Thanks for the reply.
The files are already compressed.
Can you please explain me how to implement HTTP downloads using java ?
Does it require any program to be installed like FTP ?



Regards
Ritesh
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

OK you have a servlet. and you have a file called huge.txt:


I adapted this from http://snippets.dzone.com/posts/show/4629
 
jQuery in Action, 2nd edition
 
subject: How to implement file downloading functionality ?