commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r744372 - in /commons/proper/io/trunk/src/java/org/apache/commons/io: input/TaggedInputStream.java output/TaggedOutputStream.java
Date Sat, 14 Feb 2009 02:33:12 GMT
Author: niallp
Date: Sat Feb 14 02:33:11 2009
New Revision: 744372

URL: http://svn.apache.org/viewvc?rev=744372&view=rev
Log:
IO-192 use the new exception handling methods

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/input/TaggedInputStream.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/output/TaggedOutputStream.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/TaggedInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/TaggedInputStream.java?rev=744372&r1=744371&r2=744372&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/TaggedInputStream.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/TaggedInputStream.java Sat
Feb 14 02:33:11 2009
@@ -105,67 +105,15 @@
         }
     }
 
+    /**
+     * Tags any IOExceptions thrown, wrapping and re-throwing.
+     * 
+     * @param e The IOException thrown
+     * @throws IOException if an I/O error occurs
+     */
     @Override
-    public int available() throws IOException {
-        try {
-            return super.available();
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public int read() throws IOException {
-        try {
-            return super.read();
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public int read(byte[] bts, int st, int end) throws IOException {
-        try {
-            return super.read(bts, st, end);
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public int read(byte[] bts) throws IOException {
-        try {
-            return super.read(bts);
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public long skip(long ln) throws IOException {
-        try {
-            return super.skip(ln);
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public void reset() throws IOException {
-        try {
-            super.reset();
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public void close() throws IOException {
-        try {
-            super.close();
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
+    protected void handleIOException(IOException e) throws IOException {
+        throw new TaggedIOException(e, this);
     }
 
 }

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/output/TaggedOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/output/TaggedOutputStream.java?rev=744372&r1=744371&r2=744372&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/output/TaggedOutputStream.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/output/TaggedOutputStream.java
Sat Feb 14 02:33:11 2009
@@ -105,49 +105,15 @@
         }
     }
 
+    /**
+     * Tags any IOExceptions thrown, wrapping and re-throwing.
+     *
+     * @param e The IOException thrown
+     * @throws IOException if an I/O error occurs
+     */
     @Override
-    public void write(byte[] bts, int st, int end) throws IOException {
-        try {
-            super.write(bts, st, end);
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public void write(byte[] bts) throws IOException {
-        try {
-            super.write(bts);
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public void write(int idx) throws IOException {
-        try {
-            super.write(idx);
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public void flush() throws IOException {
-        try {
-            super.flush();
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
-    }
-
-    @Override
-    public void close() throws IOException {
-        try {
-            super.close();
-        } catch (IOException e) {
-            throw new TaggedIOException(e, this);
-        }
+    protected void handleIOException(IOException e) throws IOException {
+        throw new TaggedIOException(e, this);
     }
 
 }



Mime
View raw message