/** * Creates a DataEntryReader that can read the given class path entry. * * @param messagePrefix a prefix for messages that are printed out. * @param classPathEntry the input class path entry. * @param reader a data entry reader to which the reading of actual classes and resource files can * be delegated. * @return a DataEntryReader for reading the given class path entry. */ public static DataEntryReader createDataEntryReader( String messagePrefix, ClassPathEntry classPathEntry, DataEntryReader reader) { boolean isApk = classPathEntry.isApk(); boolean isJar = classPathEntry.isJar(); boolean isAar = classPathEntry.isAar(); boolean isWar = classPathEntry.isWar(); boolean isEar = classPathEntry.isEar(); boolean isZip = classPathEntry.isZip(); List filter = classPathEntry.getFilter(); List apkFilter = classPathEntry.getApkFilter(); List jarFilter = classPathEntry.getJarFilter(); List aarFilter = classPathEntry.getAarFilter(); List warFilter = classPathEntry.getWarFilter(); List earFilter = classPathEntry.getEarFilter(); List zipFilter = classPathEntry.getZipFilter(); System.out.println( messagePrefix + (isApk ? "apk" : isJar ? "jar" : isAar ? "aar" : isWar ? "war" : isEar ? "ear" : isZip ? "zip" : "directory") + " [" + classPathEntry.getName() + "]" + (filter != null || apkFilter != null || jarFilter != null || aarFilter != null || warFilter != null || earFilter != null || zipFilter != null ? " (filtered)" : "")); // Add a filter, if specified. if (filter != null) { reader = new FilteredDataEntryReader( new DataEntryNameFilter(new ListParser(new FileNameParser()).parse(filter)), reader); } // Unzip any apks, if necessary. reader = wrapInJarReader(reader, isApk, apkFilter, ".apk"); if (!isApk) { // Unzip any jars, if necessary. reader = wrapInJarReader(reader, isJar, jarFilter, ".jar"); if (!isJar) { // Unzip any aars, if necessary. reader = wrapInJarReader(reader, isAar, aarFilter, ".aar"); if (!isAar) { // Unzip any wars, if necessary. reader = wrapInJarReader(reader, isWar, warFilter, ".war"); if (!isWar) { // Unzip any ears, if necessary. reader = wrapInJarReader(reader, isEar, earFilter, ".ear"); if (!isEar) { // Unzip any zips, if necessary. reader = wrapInJarReader(reader, isZip, zipFilter, ".zip"); } } } } } return reader; }