Try using VFS to read the content of a compressed (gz) file inside of a tar file. Extract tar file objects. If they are gzip files, decompress them. Any directory structure in the tarfile is not being preserved, the contents are pulled out to the same location regardless of directory hierarchy (for the purposes of this example, all objects in the tar file have unique names, so there are no file name conflicts).
Use a multiple step approach.
- extract gzipped file from tar file 2. decompress gzipped content to a temporary directory 3. move decompressed content to desired destination 4. remove temporary directory 5. remove gzipped file
There should be a cleaner, more direct route. Maybe someone more familiar with VFS can post better code.
This example uses Maven2. There is a pom.xml to define the project