1 In this example we are going to investigate several methods to write a File in Java.
2 That’s why we’ve used the while loop, so as log as the buffer has remaining bytes in it, we simply append them to the file.
3 So as you can imagine, this is very useful when creating a write-intensive application that writes large amounts of data to files.