← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 699: Added two methods to StreamUtils.

 

------------------------------------------------------------
revno: 699
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-14 15:52:08 +0200
message:
  Added two methods to StreamUtils.
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java	2009-09-14 13:48:27 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java	2009-09-14 13:52:08 +0000
@@ -373,4 +373,26 @@
             throw new RuntimeException( "Failed to finish ZipOutputStream", ex );
         }
     }
+    
+    /**
+     * Attempts to delete the File with the given path.
+     * 
+     * @param file the File path.
+     * @return true if the operation succeeded, false otherwise.
+     */
+    public static boolean delete( String path )
+    {
+        return new File( path ).delete();
+    }
+    
+    /**
+     * Tests whether the File with the given path exists.
+     * 
+     * @param path the File path.
+     * @return true if the File exists, false otherwise.
+     */
+    public static boolean exists( String path )
+    {
+        return new File( path ).exists();
+    }   
 }