Good point - probably better to make it explicit then. The try-with-resources should still be cleaner for closing the streams however.
Brian On Jul 7, 2016, at 1:26 PM, Phil Race <philip.r...@oracle.com> wrote: > I suppose deleteOnExit might be OK but jtreg re-uses the VM > so it will not get deleted until much later - after all N thousand tests have > been run .. assuming no other test crashes the VM before then. > > -phil. > > On 07/07/2016 10:41 AM, Brian Burkhalter wrote: >> Why not simply invoke deleteOnExit() on the file instance immediately after >> it is created and use try-with-resources blocks for the >> Image{Input,Output}Stream instances?