commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r608744 - /commons/proper/io/trunk/src/java/org/apache/commons/io/input/AutoCloseInputStream.java
Date Fri, 04 Jan 2008 04:50:11 GMT
Author: jukka
Date: Thu Jan  3 20:50:11 2008
New Revision: 608744

URL: http://svn.apache.org/viewvc?rev=608744&view=rev
Log:
IO-122 - Helper classes for controlling closing of streams
    - Added a finalizer to AutoCloseInputStream

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/input/AutoCloseInputStream.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/AutoCloseInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/AutoCloseInputStream.java?rev=608744&r1=608743&r2=608744&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/AutoCloseInputStream.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/AutoCloseInputStream.java
Thu Jan  3 20:50:11 2008
@@ -115,4 +115,14 @@
         return n;
     }
 
+    /**
+     * Ensures that the stream is closed before it gets garbage-collected.
+     * As mentioned in {@link #close()}, this is a no-op if the stream has
+     * already been closed.
+     */
+    protected void finalize() throws Throwable {
+        close();
+        super.finalize();
+    }
+
 }



Mime
View raw message