commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Bentmann (JIRA)" <j...@apache.org>
Subject [jira] Commented: (IO-46) [io] Find file in classpath
Date Thu, 24 Apr 2008 18:01:24 GMT

    [ https://issues.apache.org/jira/browse/IO-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592143#action_12592143
] 

Benjamin Bentmann commented on IO-46:
-------------------------------------

bq. What's the use case for this feature?
For example to place some input files on the test class path to fetch from when invoking File-based
APIs.

> [io] Find file in classpath
> ---------------------------
>
>                 Key: IO-46
>                 URL: https://issues.apache.org/jira/browse/IO-46
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.1
>         Environment: Operating System: other
> Platform: Other
>            Reporter: David Leal
>            Priority: Minor
>             Fix For: 2.x
>
>
> Just to suggest adding a method like this: 
>  public File findFileInClasspath(String fileName) throws FileNotFoundException 
> {
>         URL url = getClass().getClassLoader().getResource(fileName);
>         if (url == null){
>             throw new FileNotFoundException(fileName);
>         }
>         return new File(url.getFile());
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message