You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Benoit Callebaut <be...@euphonynet.be> on 2006/03/28 22:59:01 UTC

[vfs][compress] TAR Filesystem creation && temp dir

Hello,
I am running the VFS test suite. I have problems, so I do manual tests.
In one of them, I try to parse the following URI (the file does exist)
uri = "tar:gz://Z:\\programming\\apache\\jakarta\\commons\\vfs\\target\
\test-data\\nested.tar.gz!/nested.tar/file1.txt";
byy calling manager.resolveFile("uri");

During the "creation" of a "tar.gz" file, you create the tar file.

When you create a TAR Filesystem, it creates a temporary directory.

You end up with a FileObject entry representing the tar file created in
the VFS namespace. This entry represents a directory.

Afterward, when you want to create the content of thye tar file, you
first open it. At this time, you call 
createTarFile method in class TarFileSystem try to read a file on the
(local) filesystem by using the following statement : 
new TarInputStream(new FileInputStream(file));

This leads to an exception because it tries to open a directory instead
of a file.

What is the good way ? Building the whole tar tree in a stream in which
case the first part of the code is wrong (can be hard to solve since it
is something that is not in the TAR provider). Or building the entries
in a temporary location. In the later case, you have to have to handle
the case of a non yet existing tar file and first decompress it
internally if it exist.

I think the first one is better.Bu I have to check this.




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [vfs][compress] TAR Filesystem creation && temp dir

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hallo!
> I am running the VFS test suite. I have problems, so I do manual tests.
> In one of them, I try to parse the following URI (the file does exist)
> uri = "tar:gz://Z:\\programming\\apache\\jakarta\\commons\\vfs\\target\
> \test-data\\nested.tar.gz!/nested.tar/file1.txt";
> byy calling manager.resolveFile("uri");
>   
The above url has a problem. Try to change it to som

FileObject fifo =
VFS.getManager().resolveFile("tar:gz://Z:\\programming\\apache\\jakarta\\commons\\vfs\\target\\test-data\\nested.tar.gz!/nested.tar!/file1.txt");

Note the additional "!" after nested.tar. You have two layers (tar and
gz) so you need two layer demarcations.


Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org