aspose file tools*
The moose likes I/O and Streams and the fly likes is there any way to convert Jar Entry to a File Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "is there any way to convert Jar Entry to a File Object" Watch "is there any way to convert Jar Entry to a File Object" New topic
Author

is there any way to convert Jar Entry to a File Object

Bhagya Tangutur
Ranch Hand

Joined: Oct 21, 2002
Posts: 88
Is there anyway i can convert File in Jar to File Object.
I am using some third party classes which needs File as an argument.so is there any work around to get Jar entry(some x File) to Convert to File Object.and i don't want to to create new files in hard disk to perform this work.
Thanks for your time


Sun Certified Java Programmer
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Kumar- we ask that all our users follow our display name policy. Please
change]http://www.coderanch.com/forums/user/edit]change your display name[/url] to include both a first and last name. Thanks.
As for your question - it's easy to create a File object simply by using new File(name). However the third-party class you're using which expects a File object will probably also expect that there is a physical file on your hard drive which corresponds to this File object. (It will probably try to open a FileInputStream using the File object to read it.) Thus, you'll need to copy from the jar file into a new, separate file. Unless you can find another method in the 3rd-party API which uses, say, an InputStream rather than a File.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is there any way to convert Jar Entry to a File Object