cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Daniel <alexander.dan...@gmx.at>
Subject Re: Accessing resource from reader
Date Thu, 17 Sep 2009 19:18:17 GMT
On Sep 17, 2009, at 14:56 , Radaven wrote:

> Hi, I am working on my BarcodeImageReader which generates barcode  
> image. The
> parameters of barcode are loaded from xml config file (saved on same  
> place
> as other resources like jx templates, etc.).
>
> How can I get to this file to have it as java.io.File? I guess I  
> cannot use
> something like
>
> File file = new File("barcode-cfg.xml");
>
> Is there some getResource method or something like that available?

If I understand you correctly you want to access a resource from the  
classpath. Then you can use getClass().getResourceAsStream("barcode- 
cfg.xml"); [1]

Alex

[1] http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResourceAsStream%28java.lang.String%29

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message