commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r759634 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
Date Sun, 29 Mar 2009 02:41:56 GMT
Author: sebb
Date: Sun Mar 29 02:41:55 2009
New Revision: 759634

URL: http://svn.apache.org/viewvc?rev=759634&view=rev
Log:
Provide close method for stream

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java?rev=759634&r1=759633&r2=759634&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
Sun Mar 29 02:41:55 2009
@@ -34,9 +34,11 @@
 
     private final InputStream input;
     private long offset = 0;
+    private boolean closed;
 
     public ArArchiveInputStream( final InputStream pInput ) {
         input = pInput;
+        closed = false;
     }
 
     public ArArchiveEntry getNextArEntry() throws IOException {
@@ -100,6 +102,13 @@
         return getNextArEntry();
     }
 
+    public void close() throws IOException {
+        if (!closed) {
+            closed = true;
+            input.close();
+        }
+    }
+
     public int read() throws IOException {
         final int ret = input.read();
         offset++;



Mime
View raw message