Sometimes I feel there are too many classes in java to work with streams and files. InputStream is the base class of all the classes in Java IO API. The input stream class is intended to be used to read the data from different sources in chunks. This is useful for large streams that don’t fit in memory.
Lots of libraries returns objects of type InputStream and sometimes you know the stream small and you just need the data as a simple String. Here is the snippet written as a static method to transfer the data from a InputStream to a String.