When working with input/output streams, there are several steps we have to follow, which are:
When we have to repeat this process, over and over again, it is error prone and makes the code less clear and less maintainable. The Files class offers convenience methods for writing/appending to a file or reading the contents of a file into a byte array. Most of these become one-liners with the opening and closing of resources being taken care of for us.