Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: converted to 1.6 markup

...

Create this sample archive.tar file with some (unix) commands along the lines of:

No Format
ls -l > contextcontent.txt
gzip content.txt
ls -l > non-gzip.txt
mkdir tardir
mv content.txt.gz non-gzip.txt tardir
tar cvf archive.tar tardir
rm -r tardir

The contents of the content.txt and non-gzip.txt files are just a directory listings, dump in anything you want here. For this example the sample archive.tar is located in the /extra/data/tryVfs directory. You can see that hardcoded in the java example below. The content.txt and non-gzip.txt files will be extracted into the same location.

Key Concepts

Building the resolveFile 'name' String

An essential ingredient for this "recipe" is the name argument for the FileSystemManager.resolveFile(String name) method. See this in the lines defining and using String gzName, line numbers 99-101 in the ExtractFromGzipInTar.java code listing below. The important work of connecting to the content.txt file inside the content.txt.gz file inside the archive.tar file is performed by

...