Perhaps try this...

Url url = MyClass.class.getResource("someshapefile");
File shapefile = new File( url.toURI() );
FileDataStore dataStore = FileDataStoreFinder.getDataStore(file);

Michael


On 1 August 2011 09:42, Tanim Islam <[email protected]> wrote:
> Hello:
>
> I am trying to read in an ESRI shapefile, located as a resource in my jar
> archive. So I think this is the ShapeFileReader class that implements the
> instantiation of the appropriate geotools objects from the ESRI shapefile.
>
> Tanim Islam
>
> On Fri, Jul 29, 2011 at 12:57 PM, Andrea Aime <[email protected]>
> wrote:
>>
>> On Fri, Jul 29, 2011 at 6:17 PM, Tanim S. Islam <[email protected]>
>> wrote:
>> > In that case, how does one use an InputStream (rather than File or URL)
>> > as
>> > an initialization parameter?
>>
>> Wait, are you talking about using a input stream in the existing data
>> stores,
>> or writing a new one of your own?
>> In the latter case you just have to declare a Param of type input stream
>> in your datastore factory.
>> If you want to give a InputStream to a existing store, sorry, no way to do
>> that
>> directly.
>> One option is to save the contents of the stream into a temporary file and
>> then
>> point the store to it.
>>
>> More details please. What is the store you're talking about, and what are
>> the contents of the stream?
>>
>> Cheers
>> Andrea
>>
>>
>>
>> --
>> -------------------------------------------------------
>> Ing. Andrea Aime
>> GeoSolutions S.A.S.
>> Tech lead
>>
>> Via Poggio alle Viti 1187
>> 55054  Massarosa (LU)
>> Italy
>>
>> phone: +39 0584 962313
>> fax:      +39 0584 962313
>>
>> http://www.geo-solutions.it
>> http://geo-solutions.blogspot.com/
>> http://www.youtube.com/user/GeoSolutionsIT
>> http://www.linkedin.com/in/andreaaime
>> http://twitter.com/geowolf
>>
>> -------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to