I know wrapping BufferedInpurStream around FileInputStream makes read operation faster but trying to figure out how.I looked in to source code of BufferedInpurStream and got some stuff. Here is my understanding
InputStream in = new BufferedInpurStream(new FileInputStream(filename));
int byteToRead;
while((byteToRead = in.read()) != -1)
when i do bufferedInpurStream.read() , Internally ,it will first read the chunk of bytes at a time in to buffer and then read each byte one by one from buffer instead of reading it from file(which is costlier).Once that buffer is empty it will fill it again with chunk of bytes
while with FileInputStream.read() , read operation is performed for each byte one by one from file which is very costly
Is this understanding correct?