diff options
Diffstat (limited to 'jetty-util/src/main/java/org/eclipse/jetty/util/IO.java')
-rw-r--r-- | jetty-util/src/main/java/org/eclipse/jetty/util/IO.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java index f0a3d9ed1c..bc253bcc37 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IO.java @@ -1,6 +1,6 @@ // // ======================================================================== -// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 @@ -18,6 +18,7 @@ package org.eclipse.jetty.util; import java.io.ByteArrayOutputStream; +import java.io.Closeable; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -359,6 +360,24 @@ public class IO /* ------------------------------------------------------------ */ /** + * closes any {@link Closeable} + * + * @param c the closeable to close + */ + public static void close(Closeable c) + { + try + { + if (c != null) + c.close(); + } + catch (IOException e) + { + LOG.ignore(e); + } + } + + /** * closes an input stream, and logs exceptions * * @param is the input stream to close |