creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1484208 - /creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
Date Sun, 19 May 2013 02:08:50 GMT
Author: sebb
Date: Sun May 19 02:08:50 2013
New Revision: 1484208

URL: http://svn.apache.org/r1484208
Log:
Utility methods for scanning resource dirs

Modified:
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java?rev=1484208&r1=1484207&r2=1484208&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
(original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
Sun May 19 02:08:50 2013
@@ -54,6 +54,17 @@ public class Resources {
     }
 
     /**
+     * Locates a set of resource files in the class path.
+     */
+    public static File[] getResourceFiles(String pResource) throws IOException {
+        final File f = new File("src/test/resources", pResource);
+        if (!f.isDirectory()) {
+            throw new FileNotFoundException("Unable to locate resource directory: " + f);
+        }
+        return f.listFiles();
+    }
+
+    /**
      * Locates a resource file in the class path and returns an {@link InputStream}.
      */
     public static InputStream getResourceStream(String pResource) throws IOException {
@@ -75,6 +86,13 @@ public class Resources {
     }
 
     /**
+     * Locates a resource file in the class path and returns a {@link BufferedReader}.
+     */
+    public static BufferedReader getBufferedReader(File file) throws IOException {
+        return new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
+    }
+
+    /**
      * Locates the name of a directory, which contains the given
      * resource file.
      */



Mime
View raw message