You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by sowmi <so...@telenav.com> on 2008/04/19 23:57:02 UTC

Accessing a file in AAR

Hi,

I am looking for a way to access a file packaged in an AAR, as a
java.io.File object. 

I use third party API that accepts only a 'file path' that is used to create
a java.io.File object. Unfortunately they dont have any API accepting
InputStream or URL. 

Now, given that I package all my configurations in the AAR, is there a way
to generate a "file path" that I can supply to these third party API? 

Any help is appreciated.

thanks!
Sowmi
-- 
View this message in context: http://www.nabble.com/Accessing-a-file-in-AAR-tp16787898p16787898.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Accessing a file in AAR

Posted by Deepal jayasinghe <de...@gmail.com>.
Seem wrote:
> I have the same problem.
> Do I understand you right, that you pointed out a solution in this kind of
> manner:
>
> Should I use the getResourceAsStream() to get the file, create a temporary
> file from the inputstream, get the file path und use it with my 3rd party
> methods?
>   
Once you call getResourceAsStream , what you get is an input stream, and
I am not sure whether it creates a temporally file for that. But one
thing I can not understand is why do you want to access the file, if you
have the input stream you can do whatever you want with that.

Deepal 
>
>
>
> sowmi wrote:
>   
>> Since I did not hear anything, I had to get around the issue by creating
>> the file in the "java.io.tmpdir" & pass the file path to 3rd party
>> classes. Just in case somebody needs to know what I did.
>>
>>     
>
>   


-- 
Thank you!


http://blogs.deepal.org


Re: Accessing a file in AAR

Posted by Seem <si...@gmx.de>.
I have the same problem.
Do I understand you right, that you pointed out a solution in this kind of
manner:

Should I use the getResourceAsStream() to get the file, create a temporary
file from the inputstream, get the file path und use it with my 3rd party
methods?




sowmi wrote:
> 
> Since I did not hear anything, I had to get around the issue by creating
> the file in the "java.io.tmpdir" & pass the file path to 3rd party
> classes. Just in case somebody needs to know what I did.
> 

-- 
View this message in context: http://www.nabble.com/Accessing-a-file-in-AAR-tp16787898p20964762.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: Accessing a file in AAR

Posted by sowmi <so...@telenav.com>.
Since I did not hear anything, I had to get around the issue by creating the
file in the "java.io.tmpdir" & pass the file path to 3rd party classes. Just
in case somebody needs to know what I did.
-- 
View this message in context: http://www.nabble.com/Accessing-a-file-in-AAR-tp16787898p16898376.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Accessing a file in AAR

Posted by sowmi <so...@telenav.com>.
Hi Keith,

I tried getting the URL & creating the file object as "new
File(url.getFile())". But it doesn't seem to work. The file.exists() always
returns false.

Sowmi



keith chapman wrote:
> 
> Hi Sowmi,
> 
> You can use the jar URL scheme. Look here for documentation on it
> http://java.sun.com/j2se/1.4.2/docs/api/java/net/JarURLConnection.html
> 
> Thanks,
> Keith.
> 
> On Sun, Apr 20, 2008 at 3:27 AM, sowmi <so...@telenav.com> wrote:
> 
>>
>> Hi,
>>
>> I am looking for a way to access a file packaged in an AAR, as a
>> java.io.File object.
>>
>> I use third party API that accepts only a 'file path' that is used to
>> create
>> a java.io.File object. Unfortunately they dont have any API accepting
>> InputStream or URL.
>>
>> Now, given that I package all my configurations in the AAR, is there a
>> way
>> to generate a "file path" that I can supply to these third party API?
>>
>> Any help is appreciated.
>>
>> thanks!
>> Sowmi
>> --
>> View this message in context:
>> http://www.nabble.com/Accessing-a-file-in-AAR-tp16787898p16787898.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 
> -- 
> Keith Chapman
> Senior Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
> 
> blog: http://www.keith-chapman.org
> 
> 

-- 
View this message in context: http://www.nabble.com/Accessing-a-file-in-AAR-tp16787898p16799138.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Accessing a file in AAR

Posted by keith chapman <ke...@gmail.com>.
Hi Sowmi,

You can use the jar URL scheme. Look here for documentation on it
http://java.sun.com/j2se/1.4.2/docs/api/java/net/JarURLConnection.html

Thanks,
Keith.

On Sun, Apr 20, 2008 at 3:27 AM, sowmi <so...@telenav.com> wrote:

>
> Hi,
>
> I am looking for a way to access a file packaged in an AAR, as a
> java.io.File object.
>
> I use third party API that accepts only a 'file path' that is used to
> create
> a java.io.File object. Unfortunately they dont have any API accepting
> InputStream or URL.
>
> Now, given that I package all my configurations in the AAR, is there a way
> to generate a "file path" that I can supply to these third party API?
>
> Any help is appreciated.
>
> thanks!
> Sowmi
> --
> View this message in context:
> http://www.nabble.com/Accessing-a-file-in-AAR-tp16787898p16787898.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org