Apache commons-io library is almost a de-facto way for IO operations in java. What really bothers me is that it does not provide methods for automatically stream closing after io operations.
Desired workflow:
IOUtils.write(myBytes, new FileOutputStream("/path/to/file.txt"));
Current workflow:
FileOutputStream fos = new FileOutputStream("/path/to/file.txt")
IOUtils.write(myBytes, fos);
fos.close();
Can I do it in one line? What alternatives do I have? If nothing is available, why?