Changeset 19736


Ignore:
Timestamp:
06/03/09 16:53:24 (12 years ago)
Author:
ak19
Message:

Upon unzipping need to delete the dummy 'empty' files which were inserted into EMPTY directories when ZipTools generated a zip. Without deleting these, we see ugly empty files in the CollectionView of GLI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/util/UnzipTools.java

    r13328 r19736  
    6262            dir.mkdirs();
    6363
    64             // Set up input stream
    65             InputStream zis = zip_file.getInputStream(zip_entry);
    66             BufferedInputStream bzis = new BufferedInputStream(zis);
    67             DataInputStream dbzis = new DataInputStream(bzis);
    68 
    69             // Set up output stream
    70             FileOutputStream fzos = new FileOutputStream(zip_entry_file);
    71             BufferedOutputStream bfzos = new BufferedOutputStream(fzos);
    72 
    73             byte[] buf = new byte[1024];
    74             int len;
    75             while ((len = dbzis.read(buf)) >= 0) {
    76             bfzos.write(buf,0,len);
     64            // Don't need to unzip files called empty which were created during the zipping process
     65            // in order to be able to generate empty directories in a zip (see remote.ZipTools)
     66            if(!zip_entry_file.getName().equals("empty")) {
     67            // Set up input stream
     68            InputStream zis = zip_file.getInputStream(zip_entry);
     69            BufferedInputStream bzis = new BufferedInputStream(zis);
     70            DataInputStream dbzis = new DataInputStream(bzis);
     71           
     72            // Set up output stream
     73            FileOutputStream fzos = new FileOutputStream(zip_entry_file);
     74            BufferedOutputStream bfzos = new BufferedOutputStream(fzos);
     75           
     76            byte[] buf = new byte[1024];
     77            int len;
     78            while ((len = dbzis.read(buf)) >= 0) {
     79                bfzos.write(buf,0,len);
     80            }
     81           
     82            dbzis.close();
     83            bzis.close();
     84            zis.close();
     85           
     86            bfzos.close();
     87            fzos.close();
    7788            }
    78 
    79             dbzis.close();
    80             bzis.close();
    81             zis.close();
    82 
    83             bfzos.close();
    84             fzos.close();
    8589        }
    8690        }
Note: See TracChangeset for help on using the changeset viewer.