Why is the performance of BufferedReader so much worse than BufferedInputStream?
When using a BufferedInputStream make sure that the inputStream is not already buffered, double buffering will cause some seriously hard to find bugs. Also you need to handle Readers differently, converting to a StreamReader and Buffering will cause bytes to be lost if the Reader is Buffered. Also if you are using a Reader remember that you are not reading bytes but characters in the default encoding (unless an explicit encoding was set). An example of a buffered input stream, that you may not know is URL url; url.openStream();
I do not have any references for this information, it comes from debugging code. The main case where the issue occurred for me was in code that read from a file into a compressed stream. If I remember correctly once you start debugging through the code there are comments in the Java source that certain things do not work correctly always. I do not remember where the information from using BufferedReader and BufferedInputStream comes from but I think that fails straight away on even the simplest test. Remember to test this you need to be marking more than the buffer size (which is different for BufferedReader versus BufferedInputStream), the problems occur when the bytes being read reach the end of the buffer. Note there is a source code buffer size which can be different to the buffer size you set in the constructor. It is a while since I did this so my recollections of details may be a little off. Testing was done using a FilterReader/FilterInputStream, add one to the direct stream and one to the buffered stream to see the difference.
Java NIO Overview
Java NIO consist of the following core components:
Java NIO has more classes and components than these, but the Channel, Buffer and Selector forms the core of the API, in my opinion. The rest of the components,...