On 3 Jun 2009, at 03:55, Christian Catchpole wrote:
>
> Yeah, this can be a problem. Perhaps the neatest way is to do
> something like this.. use a static helper which eats the exception.
>
> OutputStream os = new BlahOutputStream();
> try {
> // do stuff hyar, hyar and hyar..
> os.write( stuff );
> } finally {
> StreamHelperThingy.closeDontThrow(os);
> }
Most code I've seen uses commons-io's IOUtils.closeQuietly() to do this…
http://commons.apache.org/io/api-1.4/org/apache/commons/io/IOUtils.html
-Dom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---