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: Described the sample data file archive.tar ------------------------------------------------------------------------------ 5. remove gzipped file There should be a cleaner, more direct route. Maybe someone more familiar with VFS can post better code. + + Conceptually there is a tar file: + {{{ + archive.tar + +- 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: + {{{ + ls -l > context.txt + gzip content.txt + mkdir tardir + mv content.txt.gz tardir + tar cvf archive.tar tardir + rm -r tardir + }}} + 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. This example uses Maven2. There is a '''{{{pom.xml}}}''' to define the project @@ -67, +84 @@ Content of '''{{{src/main/java/gov/noaa/eds/tryVfs/MultiStep.java}}}''' {{{ + /* + * MultiStep.java + */ package gov.noaa.eds.tryVfs; import org.apache.commons.vfs.AllFileSelector; @@ -95, +115 @@ * 5. remove gzipped file * * There should be a cleaner more direct route, but I haven't discovered it yet. + * + * @author ktanaka */ public class MultiStep { FileSystemManager fsManager = null; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
