Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload

 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic