commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albretch Mueller <lbrt...@gmail.com>
Subject Re: [compress] trying to feed data from tar.gz and tar.bz2 files directly to an XMLReader ...
Date Mon, 27 Jun 2011 13:33:33 GMT
 Well, that was the first thing I wishfully tried ;-), but for some
reason (I really can't get why) when I try to go
TarArchiveEntry.getFile():
~
 org/apache/commons/compress/archivers/tar/TarArchiveEntry.html
~
 I invariably get 'null' and I think, the only way I can construct an
InputStream to feed the XMLReader is by somehow going:
~
 TarArchiveInputStream TArkIS = new TarArchiveInputStream(new
BZip2CompressorInputStream(new FileInputStream(aIFl)));
 InputStream IS = TArkIS.getInputStream(TarArchiveEntry.getFile());
// __
  try{
   TArkIS = new TarArchiveInputStream(new
BZip2CompressorInputStream(new FileInputStream(aIFl)));
   TarArchiveEntry TArkEntry = (TarArchiveEntry)TArkIS.getNextEntry();
   while(TArkEntry != null){
    if(!TArkEntry.isDirectory()){
     System.err.println(TArkEntry);
     System.err.println("// __ getName: |" + TArkEntry.getName() + "|");
     System.err.println("// __ getSize: |" + TArkEntry.getSize() + "|");
     System.err.println("// __ getUserId: |" + TArkEntry.getUserId() + "|");
     System.err.println("// __ GroupId: |" + TArkEntry.getGroupId() + "|");
     System.err.println("// __ GroupName: |" + TArkEntry.getGroupName() + "|");
     System.err.println("// __ LastModifiedDate: |" +
TArkEntry.getLastModifiedDate() + "|");
     System.err.println("// __ LinkName: |" + TArkEntry.getLinkName() + "|");
     System.err.println("// __ Mode: |" + TArkEntry.getMode() + "|");
     System.err.println("// __ ModTime: |" + TArkEntry.getModTime() + "|");
     System.err.println("// __ File: |" + TArkEntry.getFile() + "|");
     System.err.println("~");
    }
    TArkEntry = (TarArchiveEntry)TArkIS.getNextEntry();
   }
  }catch(FileNotFoundException FlNFX){ FlNFX.printStackTrace(System.err); }
    catch(IOException IOX){ IOX.printStackTrace(System.err); }
~
 I checked the API and the source and I should not be getting 'null'
~
 org/apache/commons/compress/archivers/tar/TarArchiveEntry.html
~
 src-html/org/apache/commons/compress/archivers/tar/TarArchiveEntry.html#line.505
~
 src-html/org/apache/commons/compress/archivers/tar/TarArchiveEntry.html#line.127
~
 As my source file I am using the firefox installation file you can get from:
~
 mozilla.com/en-US/firefox/all.html
~
 Basically I don't want (nor do I think I must) to first unzipp and
then parse (as I did with the zip file example)
~
 You may know about a roundabout way to do that
~
 lbrtchx


On 6/27/11, Torsten Curdt <tcurdt@vafer.org> wrote:
> Try something along the lines of
>
> new TarArchiveInputStream(new GzipCompressorInputStream(new
> FileInputStream(archive)))
>
> cheers,
> Torsten
> --
> http://www.yourdailygeekery.com
> http://www.torstencurdt.com

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


Mime
View raw message