Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Creating a File object out of the contents of jar/zip file

Reply
Thread Tools

Creating a File object out of the contents of jar/zip file

 
 
kotauk@gmail.com
Guest
Posts: n/a
 
      04-06-2006
Hi,
How to create a File object of .java file contained in jar/zip file.
For eample i have a zip like test.zip
It has a file mypack.today.MyProg.java

Give the jar file how to create File object of the MyProg.java.

Any pointers would be great help

thanxs
kota

 
Reply With Quote
 
 
 
 
Fred Kleinschmidt
Guest
Posts: n/a
 
      04-06-2006

<> wrote in message
news: ups.com...
> Hi,
> How to create a File object of .java file contained in jar/zip file.
> For eample i have a zip like test.zip
> It has a file mypack.today.MyProg.java
>
> Give the jar file how to create File object of the MyProg.java.
>
> Any pointers would be great help
>
> thanxs
> kota
>


jar -x filename jarname > retrieved_file
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project


 
Reply With Quote
 
 
 
 
kotauk@gmail.com
Guest
Posts: n/a
 
      04-06-2006
Hi Fred,
I want to create java.io.File object programatically

thanks
kota

 
Reply With Quote
 
kotauk@gmail.com
Guest
Posts: n/a
 
      04-06-2006
Hi Fred,
I want to create java.io.File object programatically while reading
the jar using java.util.jar.JarFile


thanks
kota

 
Reply With Quote
 
Thomas Fritsch
Guest
Posts: n/a
 
      04-06-2006
wrote:

> I want to create java.io.File object programatically while reading
> the jar using java.util.jar.JarFile

Read <http://java.sun.com/j2se/1.4.2/docs/api/java/util/jar/JarFile.html>.
There is all you need to get an InputStream for reading a zip-entry of the
the jar. Open a FileOutputStream for the destination file. Then copy all
bytes from the InputStream to the FileOutputStream.

--
"Thomas:Fritsch$ops.de".replace(':', '.').replace('$', '@')
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      04-06-2006
On 6 Apr 2006 08:09:10 -0700, wrote, quoted or
indirectly quoted someone who said :

> I want to create java.io.File object programatically


new File( ... )
see http://mindprod.com/jgloss/file.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding contents on yaml file without overwriting actual contents Kamarulnizam Rahim Ruby 4 01-28-2011 09:10 AM
How to copy multi object array contents into single object arrays? Tuxedo Javascript 65 01-19-2010 11:22 AM
if innerHTML used twice then it replaces the contents i want it to display all the contents virendra.amritkar@gmail.com Javascript 0 06-29-2007 08:13 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Can I restrict both attribute contents and element contents in schema Don Adams XML 1 03-05-2004 12:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57