aspose file tools*
The moose likes Servlets and the fly likes File Upload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "File Upload " Watch "File Upload " New topic
Author

File Upload

amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I use following code for transfering file to client machine.
...................................

I want to enhance that code so that it not execute fast and not consume much memory.
Thanks
[ October 07, 2006: Message edited by: Ben Souther ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

dmay chug,
Javaranch tip:

If you are going to post more than a line or two of your code, wrap that
code in a set of UBB Code tags.
Doing so will help to preserve your code's indenting, making it easier to read.
If it is easier to read, more people will actaully read it and you will
stand a better chance of getting help with your question.
See UseCodeTags for more
help with UBB code tags.

I've added them to your post.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by dmay chug:
I use following code for transfering file to client machine.
...................................

I want to enhance that code so that it not execute fast and not consume much memory.
Thanks

[ October 07, 2006: Message edited by: Ben Souther ]


What happens it the length is too big and the jvm is not able to create such a large byte array.This might happend while sending a large file.In that case you can choose to create a array of some size (say 1024) and then read 1024 bytes from stream to this array and then write this byte array to the outputstream untill all the bytes from the inputstream is not read.


Rahul Bhattacharjee
LinkedIn - Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Upload