[VFS] Creating a JAR file using VFS?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[VFS] Creating a JAR file using VFS?

vmassol
Hi again,

I'm just starting with VFS and obviously I'm doing something wrong below.
I've tried to look for examples both on the VFS web site and on google but
couldn't find any example of how to create a jar/zip file using VFS.

Here's what I have:

FileObject jarFile = VFS.getManager().resolveFile("file://c:/my.jar");
jarFile.createFile();

FileObject txtFile = VFS.getManager().resolveFile("jar://c:/my.jar!/a.txt");
txtFile.createFile();
OutputStream txtFileOS = txtFile.getContent().getOutputStream();
txtFileOS.write(("yeah it rocks!").getBytes());
txtFileOS.close();

I'm pretty sure there's something I don't understand ;-)

Any pointers to tutorials or examples would be most welcome.

Thanks
-Vincent


       

       
               
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Creating a JAR file using VFS?

Mario Ivankovits
Hi Vincent!
> I've tried to look for examples both on the VFS web site and on google but
> couldn't find any example of how to create a jar/zip file using VFS.
>  
The only mistake you made was, not to contribute the code for writeable
archives ;-) *just kidding*

No write support for archives yet, sorry.
There is ongoing effort to clean-up the commons-compress interface and
later to add write support to it. If this happens, we can have it in VFS
too.

Sorry.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [VFS] Creating a JAR file using VFS?

vmassol


> -----Original Message-----
> From: Mario Ivankovits [mailto:[hidden email]]
> Sent: lundi 17 juillet 2006 08:27
> To: Jakarta Commons Users List
> Subject: Re: [VFS] Creating a JAR file using VFS?
>
> Hi Vincent!
> > I've tried to look for examples both on the VFS web site and on google
> but
> > couldn't find any example of how to create a jar/zip file using VFS.
> >
> The only mistake you made was, not to contribute the code for writeable
> archives ;-) *just kidding*
>
> No write support for archives yet, sorry.
> There is ongoing effort to clean-up the commons-compress interface and
> later to add write support to it. If this happens, we can have it in VFS
> too.

Ok, I see. I didn't realize this.

Do you know trueZip? (https://truezip.dev.java.net/). It seems to be very
comprehensive in term of features and it does support writing for archives.
It's also under the ASL v2.

I'll give it a try to create my zip files programmatically.

Thanks
-Vincent


       

       
               
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Creating a JAR file using VFS?

Mario Ivankovits
Hi Vincent!
> Do you know trueZip? (https://truezip.dev.java.net/). It seems to be very
> comprehensive in term of features and it does support writing for archives.
> It's also under the ASL v2.
>  
Yes, I know it, but I didnt like the interface.
Using java.io.File to do the stuff seems weird to me. Ok, having a
wrapper which delegates to another api - like a java.io.File wrapper for
VFS might be interresting, but - the time I looked at it - they do all
the work in File.

From users point of view this might not be that important, but for my
understanding this is not a clear api.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Creating a JAR file using VFS?

Will Pugh
In reply to this post by vmassol
I've offered to contribute code that can write archive files a few
months ago on this list, but didn't get any response.

The code is still pretty rough, but if anyone is interested, I'd be
happy to donate it and do the work needed to finish it.

   JavaDoc:
http://sandbox.sourcelabs.com/willpugh/myzip-1/docs/apidocs/

  Src Drop (old one + new Javadoc comments):
http://sandbox.sourcelabs.com/willpugh/myzip-1/myzip-1-src.zip

    --Will


Vincent Massol wrote:

>  
>
>>-----Original Message-----
>>From: Mario Ivankovits [mailto:[hidden email]]
>>Sent: lundi 17 juillet 2006 08:27
>>To: Jakarta Commons Users List
>>Subject: Re: [VFS] Creating a JAR file using VFS?
>>
>>Hi Vincent!
>>    
>>
>>>I've tried to look for examples both on the VFS web site and on google
>>>      
>>>
>>but
>>    
>>
>>>couldn't find any example of how to create a jar/zip file using VFS.
>>>
>>>      
>>>
>>The only mistake you made was, not to contribute the code for writeable
>>archives ;-) *just kidding*
>>
>>No write support for archives yet, sorry.
>>There is ongoing effort to clean-up the commons-compress interface and
>>later to add write support to it. If this happens, we can have it in VFS
>>too.
>>    
>>
>
>Ok, I see. I didn't realize this.
>
>Do you know trueZip? (https://truezip.dev.java.net/). It seems to be very
>comprehensive in term of features and it does support writing for archives.
>It's also under the ASL v2.
>
>I'll give it a try to create my zip files programmatically.
>
>Thanks
>-Vincent
>
>
>
>
>
>
>___________________________________________________________________________
>Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
>http://fr.mail.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [VFS] Creating a JAR file using VFS?

vmassol
In reply to this post by vmassol


> -----Original Message-----
> From: Vincent Massol [mailto:[hidden email]]
> Sent: lundi 17 juillet 2006 08:48
> To: 'Jakarta Commons Users List'
> Subject: RE: [VFS] Creating a JAR file using VFS?
>
>
>
> > -----Original Message-----
> > From: Mario Ivankovits [mailto:[hidden email]]
> > Sent: lundi 17 juillet 2006 08:27
> > To: Jakarta Commons Users List
> > Subject: Re: [VFS] Creating a JAR file using VFS?
> >
> > Hi Vincent!
> > > I've tried to look for examples both on the VFS web site and on google
> > but
> > > couldn't find any example of how to create a jar/zip file using VFS.
> > >
> > The only mistake you made was, not to contribute the code for writeable
> > archives ;-) *just kidding*
> >
> > No write support for archives yet, sorry.
> > There is ongoing effort to clean-up the commons-compress interface and
> > later to add write support to it. If this happens, we can have it in VFS
> > too.
>
> Ok, I see. I didn't realize this.
>
> Do you know trueZip? (https://truezip.dev.java.net/). It seems to be very
> comprehensive in term of features and it does support writing for
> archives. It's also under the ASL v2.
>
> I'll give it a try to create my zip files programmatically.

Actually what is was looking for was the ability to easily create JAR files
in memory (zip:ram) for Cargo's unit tests. I think it would be quite neat
to be able to do so rather than have to go through the local file system.

Would you know of a framework that could help do this?

Thanks
-Vincent


       

       
               
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Creating a JAR file using VFS?

Mario Ivankovits
In reply to this post by Will Pugh
Hi!
> I've offered to contribute code that can write archive files a few
> months ago on this list, but didn't get any response.
Huh! Did I miss it? Sorry.

Once we finished the comons-compress api cleanup it might be great to
help out and get your code in there too. This will be the correct place
for it.


Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] Creating a JAR file using VFS?

Mario Ivankovits
In reply to this post by vmassol
Hi Vincent!

> Actually what is was looking for was the ability to easily create JAR files
> in memory (zip:ram) for Cargo's unit tests. I think it would be quite neat
> to be able to do so rather than have to go through the local file system.
>
> Would you know of a framework that could help do this?
>  
No. VFS will support it sometimes .... if it wouldnt be that much work :-(
What you can try is to use ZipOutputStream and feed it to a VFS ram url.
Not nice, but might work and you can use VFS ram filesystem.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [VFS] Creating a JAR file using VFS?

vmassol


> -----Original Message-----
> From: Mario Ivankovits [mailto:[hidden email]]
> Sent: lundi 17 juillet 2006 09:30
> To: Jakarta Commons Users List
> Subject: Re: [VFS] Creating a JAR file using VFS?
>
> Hi Vincent!
>
> > Actually what is was looking for was the ability to easily create JAR
> files
> > in memory (zip:ram) for Cargo's unit tests. I think it would be quite
> neat
> > to be able to do so rather than have to go through the local file
> system.
> >
> > Would you know of a framework that could help do this?
> >
> No. VFS will support it sometimes .... if it wouldnt be that much work :-(
> What you can try is to use ZipOutputStream and feed it to a VFS ram url.
> Not nice, but might work and you can use VFS ram filesystem.

Thanks Mario. The following is working quite fine. I'm putting it here for
posterity in case anyone is interested in doing the same:

FileObject testJar = VFS.getManager().resolveFile("ram:///test.jar");
ZipOutputStream zos =
    new ZipOutputStream(testJar.getContent().getOutputStream());
ZipEntry zipEntry = new ZipEntry("rootResource.txt");
zos.putNextEntry(zipEntry);
zos.write("Some content".getBytes());
zos.closeEntry();
zos.close();

Thanks again for all your help
-Vincent


       

       
               
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]