DataEntryCopier.java revision b72c5c2e5482cf10117b2b25f642f7616b2326c3
1b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato/* 2b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ProGuard -- shrinking, optimization, obfuscation, and preverification 3b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * of Java bytecode. 4b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 5b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) 6b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 7b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This program is free software; you can redistribute it and/or modify it 8b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * under the terms of the GNU General Public License as published by the Free 9b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Software Foundation; either version 2 of the License, or (at your option) 10b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * any later version. 11b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 12b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This program is distributed in the hope that it will be useful, but WITHOUT 13b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * more details. 16b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 17b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * You should have received a copy of the GNU General Public License along 18b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * with this program; if not, write to the Free Software Foundation, Inc., 19b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 21b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratopackage proguard.io; 22b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 23b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport proguard.util.ExtensionMatcher; 24b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 25b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratoimport java.io.*; 26b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 27b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 28b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato/** 29b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * This DataEntryReader writes the ZIP entries and files that it reads to a 30b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * given DataEntryWriter. 31b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * 32b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * @author Eric Lafortune 33b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 34b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onoratopublic class DataEntryCopier implements DataEntryReader 35b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato{ 36b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato private static final int BUFFER_SIZE = 1024; 37b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 38b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato private final DataEntryWriter dataEntryWriter; 39b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato private final byte[] buffer = new byte[BUFFER_SIZE]; 40b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 41b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 42b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 43b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato public DataEntryCopier(DataEntryWriter dataEntryWriter) 44b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 45b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato this.dataEntryWriter = dataEntryWriter; 46b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 47b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 48b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 49b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Implementations for DataEntryReader. 50b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 51b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato public void read(DataEntry dataEntry) throws IOException 52b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 53b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato try 54b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 55b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (dataEntry.isDirectory()) 56b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 57b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato dataEntryWriter.createDirectory(dataEntry); 58b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 59b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 60b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 61b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Get the output entry corresponding to this input entry. 62b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato OutputStream outputStream = dataEntryWriter.getOutputStream(dataEntry); 63b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (outputStream != null) 64b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 65b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato InputStream inputStream = dataEntry.getInputStream(); 66b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 67b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Copy the data from the input entry to the output entry. 68b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato copyData(inputStream, outputStream); 69b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 70b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Close the data entries. 71b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato dataEntry.closeInputStream(); 72b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 73b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 74b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 75b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato catch (IOException ex) 76b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 77b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato System.err.println("Warning: can't write resource [" + dataEntry.getName() + "] (" + ex.getMessage() + ")"); 78b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 79b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 80b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 81b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 82b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 83b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * Copies all data that it can read from the given input stream to the 84b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * given output stream. 85b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 86b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato protected void copyData(InputStream inputStream, 87b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato OutputStream outputStream) 88b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato throws IOException 89b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 90b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato while (true) 91b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 92b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato int count = inputStream.read(buffer); 93b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (count < 0) 94b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 95b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato break; 96b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 97b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato outputStream.write(buffer, 0, count); 98b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 99b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 100b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato outputStream.flush(); 101b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 102b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 103b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 104b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato /** 105b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato * A main method for testing file/jar/war/directory copying. 106b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato */ 107b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato public static void main(String[] args) 108b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 109b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato try 110b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 111b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato String input = args[0]; 112b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato String output = args[1]; 113b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 114b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean outputIsJar = output.endsWith(".jar"); 115b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean outputIsWar = output.endsWith(".war"); 116b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean outputIsEar = output.endsWith(".ear"); 117b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean outputIsZip = output.endsWith(".zip"); 118b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 119b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryWriter writer = new DirectoryWriter(new File(output), 120b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato outputIsJar || 121b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato outputIsWar || 122b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato outputIsEar || 123b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato outputIsZip); 124b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 125b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (!outputIsJar) 126b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 127b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Zip up any zips, if necessary. 128b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryWriter zipWriter = new JarWriter(writer); 129b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (outputIsZip) 130b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 131b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Always zip. 132b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer = zipWriter; 133b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 134b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 135b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 136b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Only zip up zips. 137b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer = new FilteredDataEntryWriter(new DataEntryParentFilter( 138b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new DataEntryNameFilter( 139b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new ExtensionMatcher(".zip"))), 140b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato zipWriter, 141b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer); 142b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 143b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 144b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Zip up any wars, if necessary. 145b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryWriter warWriter = new JarWriter(writer); 146b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (outputIsWar) 147b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 148b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Always zip. 149b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer = warWriter; 150b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 151b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 152b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 153b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Only zip up wars. 154b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer = new FilteredDataEntryWriter(new DataEntryParentFilter( 155b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new DataEntryNameFilter( 156b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new ExtensionMatcher(".war"))), 157b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato warWriter, 158b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer); 159b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 160b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 161b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 162b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Zip up any jars, if necessary. 163b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryWriter jarWriter = new JarWriter(writer); 164b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (outputIsJar) 165b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 166b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Always zip. 167b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer = jarWriter; 168b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 169b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 170b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 171b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Only zip up jars. 172b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer = new FilteredDataEntryWriter(new DataEntryParentFilter( 173b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new DataEntryNameFilter( 174b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new ExtensionMatcher(".jar"))), 175b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato jarWriter, 176b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer); 177b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 178b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 179b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 180b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Create the copying DataEntryReader. 181b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryReader reader = new DataEntryCopier(writer); 182b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 183b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 184b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean inputIsJar = input.endsWith(".jar"); 185b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean inputIsWar = input.endsWith(".war"); 186b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato boolean inputIsZip = input.endsWith(".zip"); 187b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 188b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Unzip any jars, if necessary. 189b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryReader jarReader = new JarReader(reader); 190b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (inputIsJar) 191b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 192b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Always unzip. 193b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader = jarReader; 194b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 195b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 196b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 197b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Only unzip jar entries. 198b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader = new FilteredDataEntryReader(new DataEntryNameFilter( 199b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new ExtensionMatcher(".jar")), 200b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato jarReader, 201b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader); 202b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 203b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Unzip any wars, if necessary. 204b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryReader warReader = new JarReader(reader); 205b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (inputIsWar) 206b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 207b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Always unzip. 208b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader = warReader; 209b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 210b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 211b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 212b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Only unzip war entries. 213b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader = new FilteredDataEntryReader(new DataEntryNameFilter( 214b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new ExtensionMatcher(".war")), 215b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato warReader, 216b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader); 217b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 218b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 219b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Unzip any zips, if necessary. 220b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DataEntryReader zipReader = new JarReader(reader); 221b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato if (inputIsZip) 222b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 223b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Always unzip. 224b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader = zipReader; 225b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 226b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato else 227b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 228b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato // Only unzip zip entries. 229b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader = new FilteredDataEntryReader(new DataEntryNameFilter( 230b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato new ExtensionMatcher(".zip")), 231b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato zipReader, 232b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato reader); 233b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 234b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 235b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 236b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato DirectoryPump directoryReader = new DirectoryPump(new File(input)); 237b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 238b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato directoryReader.pumpDataEntries(reader); 239b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 240b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato writer.close(); 241b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 242b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato catch (Exception ex) 243b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato { 244b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato ex.printStackTrace(); 245b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 246b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato } 247b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato} 248