Optimum buffer size for File reading
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andy_Jefferies
Posted On:   Wednesday, March 20, 2002 07:43 AM

I'm reading files off disk (PDF 2-5Mb) and serving them to a ServletOutputStream within an application that doesn't want this servlet to hog all the memory.

What's a good platform independent buffer size to use? Failing that, what's a good Windows buffer size to use?

Re: Optimum buffer size for File reading

Posted By:   Christopher_Schultz  
Posted On:   Wednesday, March 20, 2002 11:22 AM

Usually multiples of 1024 bytes (1k) are pretty good. You see a lot of 4k buffers being used.



I would recommend using a BufferedInputStream, which does its own buffering, so you don't have to worry about it.



-chris
About | Sitemap | Contact