Relative Content

Tag Archive for javainputstreamfilereaderreaderinputstreamreader

InputStream and Reader subclass hierarchy difference

The InputStream abstract class has FileInputStream and FilterInputStream as a direct subclass. FileInputStream has all necessary code to establish an input connection from a file, whereas FilterInputStream is created as a wrapper which acts as a decorator and facilitates other classes extending it to provide a specific and specialized operation on InputStream, hence BufferedInputStream is a subclass of it and provide buffering capabilities by introducing an in-memory byte-array which acts as a storage for reducing System input calls directly to the file-system. This complete hierarchy makes sense.