Guaranteeing a file close
<p>I have a class where I create a file object in the constructor. This class also implements a finish() method as part of its interface and in this method I close the file object. The problem is that if I get an exception before this point, the file will not be closed. The class in question has a number of other methods that use the file object. Do I need to wrap all of these in a <strong>try finally</strong> clause or is there a better approach? </p>

<p>Thanks,</p>

<p>Barry</p>
