From: <pat...@us...> - 2009-11-05 21:00:05
|
Revision: 977 http://cishell.svn.sourceforge.net/cishell/?rev=977&view=rev Author: pataphil Date: 2009-11-05 20:59:55 +0000 (Thu, 05 Nov 2009) Log Message: ----------- * Added FileUtilities.loadFileFromClassPath. Not reviewed since it's so simple. Modified Paths: -------------- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java =================================================================== --- trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2009-11-03 20:01:05 UTC (rev 976) +++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/FileUtilities.java 2009-11-05 20:59:55 UTC (rev 977) @@ -9,6 +9,8 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.channels.FileChannel; import javax.imageio.ImageIO; @@ -225,6 +227,13 @@ } } + public static File loadFileFromClassPath(Class clazz, String filePath) + throws URISyntaxException { + URL fileURL = clazz.getResource(filePath); + + return new File(fileURL.toURI()); + } + private static File ensureDirectoryExists(String directoryPath) { File directory = new File(directoryPath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |