Buffer Size for BufferedInputStream

user2507974 picture user2507974 · Oct 24, 2013 · Viewed 10.9k times · Source

How to determine the size of Buffer, while using Buffered Input Stream for reading batch of files? Is it based on the File size?I'm using,

byte[] buf = new byte[4096];

If i increase the buffer size,it will read quickly?

Answer

user207421 picture user207421 · Oct 24, 2013

The default, which is deliberately undocumented, is 8192 bytes. Unless you have a compelling reason to change it, don't change it,