You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/01/14 22:29:39 UTC
svn commit: r899417 -
/incubator/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
Author: sabob
Date: Thu Jan 14 21:29:39 2010
New Revision: 899417
URL: http://svn.apache.org/viewvc?rev=899417&view=rev
Log:
close method updated to use Java5 Closeable instead of reader, writer and streams
Modified:
incubator/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
Modified: incubator/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java?rev=899417&r1=899416&r2=899417&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java Thu Jan 14 21:29:39 2010
@@ -20,6 +20,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -27,7 +28,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
-import java.io.Reader;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
@@ -574,14 +574,15 @@
}
/**
- * Close the given input stream and ignore any exceptions thrown.
+ * Close the given closeable (stream, reader or writer) and ignore any
+ * exceptions thrown.
*
- * @param stream the input stream to close.
+ * @param closeable the stream, reader or writer to close.
*/
- public static void close(InputStream stream) {
- if (stream != null) {
+ public static void close(Closeable closeable) {
+ if (closeable != null) {
try {
- stream.close();
+ closeable.close();
} catch (IOException ex) {
// Ignore.
}
@@ -589,36 +590,6 @@
}
/**
- * Close the given output stream and ignore any exceptions thrown.
- *
- * @param stream the output stream to close.
- */
- public static void close(OutputStream stream) {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException ex) {
- // Ignore.
- }
- }
- }
-
- /**
- * Close the given reader and ignore any exceptions thrown.
- *
- * @param reader the reader to close.
- */
- public static void close(Reader reader) {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ioe) {
- // Ignore
- }
- }
- }
-
- /**
* Create an HTML import statement from the given string pattern and
* versionIndicator, formatted with the request context path.
* <p/>