Retroweaver cannot handle converting things that use Closeable, so we must

remain backward compatible.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2095 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2007-04-23 21:58:33 +00:00
parent 31262e70b2
commit c47fe8dbcc
+21 -6
View File
@@ -3,10 +3,11 @@
package com.samskivert.io; package com.samskivert.io;
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.Writer;
import java.io.Reader;
import com.samskivert.Log; import com.samskivert.Log;
@@ -44,15 +45,29 @@ public class StreamUtil
} }
/** /**
* Convenient close for a Closeable. Use in a finally clause and love life. * Convenient close for a Reader. Use in a finally clause and love life.
*/ */
public static void close (Closeable c) public static void close (Reader in)
{ {
if (c != null) { if (in != null) {
try { try {
c.close(); in.close();
} catch (IOException ioe) { } catch (IOException ioe) {
Log.warning("Error closing closeable [obj=" + c + ", cause=" + ioe + "]."); Log.warning("Error closing reader [reader=" + in + ", cause=" + ioe + "].");
}
}
}
/**
* Convenient close for a Writer. Use in a finally clause and love life.
*/
public static void close (Writer out)
{
if (out != null) {
try {
out.close();
} catch (IOException ioe) {
Log.warning("Error closing writer [writer=" + out + ", cause=" + ioe + "].");
} }
} }
} }