
Een dagje frustratie en een volle datamining share later, onze vriend google legt uit "untar would go into infinite loop for some invalid tar files." Fijn! Sofie Sofie Van Landeghem wrote:
De files zelf zijn niet groot (paar KB), dus het kan niet zo'n kwaad om volledig in memory te steken (gesteld dat ze daar niet blijven zitten). Tnx voor pointer, 'k ga dat eens uitproberen!
Sofie
Thomas Abeel wrote:
TarInputStream tis=new TarInputStream(new GZIPInputStream(new FileInputstream(...)));
http://www.docjar.com/docs/api/org/apache/tools/tar/TarInputStream.html
apache-ant-<version>.jar heeft die klasse en wat erbij hoort
Anders ook te downloaded van de originele auteur: http://www.trustice.com/java/tar/
Ik vind wel niet direct sample code, maar eens gauw proberen iets samen te kletsen
TarEntry e=tis.getNextEntry() while(e!=null){ //do something // for example read it byte[]buffer=new byte[e.available()]; tis.read(buffer,0,buffer.length); //wss netter te doen met niet hele entries (files) tegelijk in memory te lezen e=tis.getNextEntry(); }
cheers, Thomas
Sofie Van Landeghem schreef:
Does anybody have experience with reading archive files in Java without actually unpacking them on the drive? I have a butload of tar.gz's I need to read in, but I'm wondering how to do this efficiently / without having to fill up the entire group share (accidently deleting people's personal pic's and music along the way)
Cheers, Sofie
_______________________________________________ Binari Implicitly Neglects All Recursive Iterations https://maillist.psb.ugent.be/mailman/listinfo/binari
-- Sofie Van Landeghem PhD Student VIB Department of Plant Systems Biology, Ghent University Bioinformatics and Systems Biology Technologiepark 927, 9052 Gent, BELGIUM Tel: +32 (0)9 331 36 95 Website: http://bioinformatics.psb.ugent.be
------------------------------------------------------------------------
_______________________________________________ Binari Implicitly Neglects All Recursive Iterations https://maillist.psb.ugent.be/mailman/listinfo/binari
-- Sofie Van Landeghem PhD Student VIB Department of Plant Systems Biology, Ghent University Bioinformatics and Systems Biology Technologiepark 927, 9052 Gent, BELGIUM Tel: +32 (0)9 331 36 95 Website: http://bioinformatics.psb.ugent.be