diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/util/IOUtil.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/util/IOUtil.java index 57b1aed5d9..460498afdb 100644 --- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/util/IOUtil.java +++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/util/IOUtil.java @@ -1,10 +1,7 @@ package net.sourceforge.pmd.eclipse.util; +import java.io.Closeable; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; /** * @@ -14,39 +11,12 @@ public class IOUtil { private IOUtil() {} - public static void closeQuietly(OutputStream stream) { - if (stream == null) return; + public static void closeQuietly(Closeable closeable) { + if (closeable == null) return; try { - stream.close(); + closeable.close(); } catch (IOException ex) { // ignore } } - - public static void closeQuietly(InputStream stream) { - if (stream == null) return; - try { - stream.close(); - } catch (IOException ex) { - // ignore - } - } - - public static void closeQuietly(Writer writer) { - if (writer == null) return; - try { - writer.close(); - } catch (IOException ex) { - // ignore it - } - } - - public static void closeQuietly(Reader reader) { - if (reader == null) return; - try { - reader.close(); - } catch (IOException ex) { - //ignore - } - } }