commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Commons Wiki] Update of "ExtractAndDecompressGzipFiles" by KenTanaka
Date Tue, 06 Nov 2007 22:41:57 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.

The following page has been changed by KenTanaka:
http://wiki.apache.org/jakarta-commons/ExtractAndDecompressGzipFiles

The comment on the change is:
Put in some instruction on compiling and running, plus some headers for sections

------------------------------------------------------------------------------
+ = Overview =
  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.
@@ -17, +18 @@

   +- tardir/
       +- content.txt.gz
  }}}
- I'd like to end up with an uncompressed file "content.txt". Create this sample {{{archive.tar}}}
file with some (unix) commands like:
+ I'd like to end up with an uncompressed file "content.txt". 
+ 
+ = Sample data file =
+ Create this sample {{{archive.tar}}} file with some (unix) commands along the lines of:
  {{{
  ls -l > context.txt
  gzip content.txt
@@ -28, +32 @@

  }}}
  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}}} file
will be extracted into the same location.
  
+ = pom.xml Project file =
  This example uses Maven2. There is a '''{{{pom.xml}}}''' to define the project
  
  {{{
@@ -82, +87 @@

  </project>
  }}}
  
+ = Source Code =
  Content of '''{{{src/main/java/gov/noaa/eds/tryVfs/MultiStep.java}}}'''
  {{{
  /*
@@ -246, +252 @@

  
  }}}
  
+ = Compiling =
+ Compile the source code with
+ {{{
+ mvn assembly:assembly
+ }}}
+ This will create an executable jar file in the standard {{{target}}} directory.
+ = Running =
+ Use a command like this to run the example
+ {{{
+ java -jar target/tryVfs-1.0-SNAPSHOT-jar-with-dependencies.jar
+ }}}
+ 
+ == Sample Output ==
+ {{{
+ Nov 6, 2007 2:38:56 PM org.apache.commons.vfs.VfsLog info
+ INFO: Using "/tmp/vfs_cache" as temporary files store.
+ Resolve tar file:
+   Path     : /
+   URI      : tar:file:///extra/data/tryVfs/archive.tar!/
+ Extracting file:///extra/data/tryVfs/content.txt.gz
+ Decompressing file:///extra/data/tryVfs/content.txt.gz
+ gzName=gz:///extra/data/tryVfs/content.txt.gz
+ fileName   =content.txt
+ decompName =file:///extra/data/tryVfs/content.txt
+ tmpDirname =file:///extra/data/tryVfs/content.txt.tmp
+ tmpFilename=file:///extra/data/tryVfs/content.txt.tmp/content.txt
+ }}}
+ 

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


Mime
View raw message