Ugo Taddei ha scritto:
> Hello,
> 
>> * ShapefileRenderer ignores any spatial index, when the URL protocol is not 
>> "file"- so the index in "jar:file:/home/some.jar!/some.gpx" is ignored.
>>
>> * GeoTiffReader also only checks for 
>>>                             if 
>>> (sourceURL.getProtocol().equalsIgnoreCase("http")
>>>                                             || 
>>> sourceURL.getProtocol().equalsIgnoreCase("ftp")) {
>>>                                     try {
>>>                                             source = sourceURL.openStream();
>>>                                     } catch (IOException e) {
>>>                                             new RuntimeException(e);
>>>                                     }
>> and simply doesn't accept jar:... URLs.
>>
> 
> Wouldn't it be better for those classes to take in InputStream as a 
> parameter rather than an URL?
> 
> You can always use both:
> InputStream stream = AClass.class.getResourceAsStream(resourceName);
> 
> URL u = AClass.class.getResource(resourceName);
> 
> But the former would always work (if the adapter in question implemented 
>   a method taking an InputStream).

That won't work afaik, the classes need to reopen over and over the
same source, so a plain input stream won't work.
They also use NIO extensively, that's why they assume files, but
I've found this bridge:
http://www.j2ee.me/j2se/1.4.2/docs/api/java/nio/channels/Channels.html
that allows to bridge between streams and channels.
Now, afaik we also use extensively random access, so I think not even
the above will work, but one never knows.

As for Stefan use case, can't you just keep your files on the
CD as plain files instead of sticking them into the classpath?

Cheers
Andrea

-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to