Java 类org.apache.tools.ant.types.ZipFileSet 实例源码

项目:ant    文件:Zip.java   
/** Process groupfilesets */
private void processGroupFilesets() {
    // Add the files found in groupfileset to fileset
    for (FileSet fs : groupfilesets) {
        logWhenWriting("Processing groupfileset ", Project.MSG_VERBOSE);
        final FileScanner scanner = fs.getDirectoryScanner(getProject());
        final File basedir = scanner.getBasedir();
        for (String file : scanner.getIncludedFiles()) {
            logWhenWriting("Adding file " + file + " to fileset",
                           Project.MSG_VERBOSE);
            final ZipFileSet zf = new ZipFileSet();
            zf.setProject(getProject());
            zf.setSrc(new File(basedir, file));
            add(zf);
            filesetsFromGroupfilesets.add(zf);
        }
    }
}
项目:incubator-netbeans    文件:MakeJNLP.java   
private void processIndirectFiles(Writer fileWriter, String dashcnb) throws IOException, BuildException {
    if (indirectFiles == null) {
        return;
    }
    DirectoryScanner scan = indirectFiles.getDirectoryScanner(getProject());
    Map<String,File> entries = new LinkedHashMap<>();
    for (String f : scan.getIncludedFiles()) {
        entries.put(f.replace(File.separatorChar, '/'), new File(scan.getBasedir(), f));
    }
    if (entries.isEmpty()) {
        return;
    }
    File ext = new File(new File(targetFile, dashcnb), "extra-files.jar");
    Zip jartask = (Zip) getProject().createTask("jar");
    jartask.setDestFile(ext);
    for (Map.Entry<String,File> entry : entries.entrySet()) {
        ZipFileSet zfs = new ZipFileSet();
        zfs.setFile(entry.getValue());
        zfs.setFullpath("META-INF/files/" + entry.getKey());
        jartask.addZipfileset(zfs);
    }
    jartask.execute();
    fileWriter.write(constructJarHref(ext, dashcnb));
    signOrCopy(ext, null);
}
项目:Maven-IIB9-Plug-In    文件:ZipUtils.java   
/**
 * Removes files from a given zip file.
 * 
 * @param zipFile name of the zip file to be modified
 * @param removePattern pattern of the files to be removed
 * 
 * @throws IOException
 */
public static void removeFiles(File zipFile, String removePattern) throws IOException {
    String zipFileName = zipFile.getName();
    File tmpFile = new File(zipFile.getCanonicalPath() + ".tmp");
    Project antProject = new Project();
    Target antTarget = new Target();
    antProject.addTarget("zip", antTarget);
    Zip zipTask = new Zip();
    zipTask.setProject(antProject);
    zipTask.setDestFile(tmpFile);
    ZipFileSet set = new ZipFileSet();
    set.setSrc(zipFile);
    set.setExcludes(removePattern);
    zipTask.addZipfileset(set);
    antTarget.addTask(zipTask);
    antTarget.execute();
    zipFile.delete();
    tmpFile.renameTo(new File(tmpFile.getParentFile(), zipFileName));
}
项目:openwonderland    文件:ModuleTask.java   
private void writeModuleInfo() throws IOException, JAXBException {
    ModuleInfo mi = new ModuleInfo(name, majorVersion, minorVersion,
            miniVersion, moduleDescription);

    File moduleInfoFile;
    if (buildDir == null) {
        moduleInfoFile = File.createTempFile("moduleInfo", "xml");
        moduleInfoFile.deleteOnExit();
    } else {
        moduleInfoFile = new File(buildDir, "moduleInfo.xml");
    }

    if (overwrite || !compareModuleInfo(mi, moduleInfoFile)) {
        log("Rewriting moduleInfo file", Project.MSG_VERBOSE);
        FileWriter writer = new FileWriter(moduleInfoFile);
        mi.encode(writer);
        writer.close();
    }

    ZipFileSet zfs = new ZipFileSet();
    zfs.setFile(moduleInfoFile);
    zfs.setFullpath(Module.MODULE_INFO);

    super.addFileset(zfs);
}
项目:jarjar    文件:AntJarProcessor.java   
@Override
protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath,
        long lastModified, File fromArchive, int mode) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    IoUtil.copy(is, baos, buf);
    struct.data = baos.toByteArray();
    struct.name = vPath;
    struct.time = lastModified;
    if (proc.process(struct) != JarProcessor.Result.DISCARD) {
        if (mode == 0)
            mode = ZipFileSet.DEFAULT_FILE_MODE;
        if (!filesOnly) {
            addParentDirs(struct.name, zOut);
        }
        super.zipFile(new ByteArrayInputStream(struct.data),
                zOut, struct.name, struct.time, fromArchive, mode);
    }
}
项目:bazel    文件:AntJarProcessor.java   
@Override
protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath,
        long lastModified, File fromArchive, int mode) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    IoUtil.copy(is, baos, buf);
    struct.data = baos.toByteArray();
    struct.name = vPath;
    struct.time = lastModified;
    if (proc.process(struct) != JarProcessor.Result.DISCARD) {
        if (mode == 0)
            mode = ZipFileSet.DEFAULT_FILE_MODE;
        if (!filesOnly) {
            addParentDirs(struct.name, zOut);
        }
        super.zipFile(new ByteArrayInputStream(struct.data),
                zOut, struct.name, struct.time, fromArchive, mode);
    }
}
项目:nbm-maven    文件:MakeJnlp2.java   
private void processIndirectFiles(Writer fileWriter, String dashcnb) throws IOException, BuildException {
    if (indirectFiles == null) {
        return;
    }
    DirectoryScanner scan = indirectFiles.getDirectoryScanner(getProject());
    Map<String,File> entries = new LinkedHashMap<String,File>();
    for (String f : scan.getIncludedFiles()) {
        entries.put(f.replace(File.separatorChar, '/'), new File(scan.getBasedir(), f));
    }
    if (entries.isEmpty()) {
        return;
    }
    File ext = new File(new File(targetFile, dashcnb), "extra-files.jar");
    Zip jartask = (Zip) getProject().createTask("jar");
    jartask.setDestFile(ext);
    for (Map.Entry<String,File> entry : entries.entrySet()) {
        ZipFileSet zfs = new ZipFileSet();
        zfs.setFile(entry.getValue());
        zfs.setFullpath("META-INF/files/" + entry.getKey());
        jartask.addZipfileset(zfs);
    }
    jartask.execute();
    fileWriter.write(constructJarHref(ext, dashcnb));
    signOrCopy(ext, null);
}
项目:ci.ant    文件:CompileJSPs.java   
private void updateSourceWar(File jspCompileDir) {
    // Finally need to merge the compiled jsps in
    War warTask = new War();
    warTask.setProject(getProject());
    warTask.setDestFile(war);
    warTask.setUpdate(true);
    ZipFileSet jspFiles = new ZipFileSet();
    // The JSPs will be in the a well known location. The
    // app name from server.xml and the war file name will
    // be
    // in the path, the war name minus the .war extension
    // (if present) will also be used.
    jspFiles.setDir(jspCompileDir);
    warTask.addClasses(jspFiles);
    warTask.setTaskName(getTaskName());
    warTask.execute();
}
项目:reladomo    文件:JarVersionCreator.java   
private void createVersionInfo(ZipOutputStream zOut) throws IOException
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(baos, "UTF8"));

    CRC32 fullCrc = new CRC32();
    // header
    writer.print("name: ");
    writer.println(applicationName);
    writer.print("version: ");
    writer.println(this.version);

    fullCrc.update(applicationName.getBytes("UTF8"));
    fullCrc.update(version.getBytes("UTF8"));

    writeVersionInfo(writer, fullCrc);
    writer.println();
    writer.print(":crc: ");
    writer.println(Long.toHexString(fullCrc.getValue()));

    if (writer.checkError())
    {
        throw new IOException("Encountered an error writing jar version information");
    }
    writer.close();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    super.zipFile(bais, zOut, "META-INF/"+applicationName+".crcver", System.currentTimeMillis(), null, ZipFileSet.DEFAULT_FILE_MODE);
    bais.close();
}
项目:gs-xsd2bean    文件:JarVersionCreator.java   
private void createVersionInfo(ZipOutputStream zOut) throws IOException
{
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(baos, "UTF8"));

    CRC32 fullCrc = new CRC32();
    // header
    writer.print("name: ");
    writer.println(applicationName);
    writer.print("version: ");
    writer.println(this.version);

    fullCrc.update(applicationName.getBytes("UTF8"));
    fullCrc.update(version.getBytes("UTF8"));

    writeVersionInfo(writer, fullCrc);
    writer.println();
    writer.print(":crc: ");
    writer.println(Long.toHexString(fullCrc.getValue()));

    if (writer.checkError())
    {
        throw new IOException("Encountered an error writing jar version information");
    }
    writer.close();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    super.zipFile(bais, zOut, "META-INF/"+applicationName+".crcver", System.currentTimeMillis(), null, ZipFileSet.DEFAULT_FILE_MODE);
    bais.close();
}
项目:intellij-ce-playground    文件:Container.java   
protected static LayoutFileSet createCopy(FileSet set) {
    if (set instanceof IdeaModule) {
        return new IdeaModule((IdeaModule) set);
    }
    if (set instanceof IdeaModuleTests) {
        return new IdeaModuleTests((IdeaModuleTests) set);
    }
    if (set instanceof ZipFileSet) {
        return new LayoutFileSet((ZipFileSet) set.clone());
    } else {
        return new LayoutFileSet((FileSet) set.clone());
    }
}
项目:openwonderland    文件:ModuleTask.java   
private void writeRequires() throws IOException, JAXBException {
    Set<ModuleInfo> mis = new HashSet<ModuleInfo>();
    for (Requires r : requires) {
        mis.add(new ModuleInfo(r.name, r.majorVersion, r.minorVersion,
                r.miniVersion));
    }

    ModuleRequires mr = new ModuleRequires(mis.toArray(new ModuleInfo[0]));

    File moduleRequiresFile;
    if (buildDir == null) {
        moduleRequiresFile = File.createTempFile("moduleRequires", ".xml");
        moduleRequiresFile.deleteOnExit();
    } else {
        moduleRequiresFile = new File(buildDir, "moduleRequires.xml");
    }

    if (overwrite || !compareModuleRequires(mr, moduleRequiresFile)) {
        log("Rewriting moduleRequires file", Project.MSG_VERBOSE);
        FileOutputStream fos = new FileOutputStream(moduleRequiresFile);
        mr.encode(fos);
        fos.close();
    }

    ZipFileSet zfs = new ZipFileSet();
    zfs.setFile(moduleRequiresFile);
    zfs.setFullpath(Module.MODULE_REQUIRES);

    super.addFileset(zfs);
}
项目:openwonderland    文件:ModuleTask.java   
private void writeModuleJar(String partName, ModuleJar jar) 
    throws IOException
{
    String jarname = jar.getName();
    if (jarname.indexOf(".") == -1) {
        jarname += ".jar";
    }

    File jarFile;
    if (buildDir == null) {
        jarFile = File.createTempFile(jar.getName(), ".jar");
        jarFile.delete();
        jarFile.deleteOnExit();
    } else {
        File jarBuildDir = new File(buildDir, partName);            
        jarBuildDir.mkdirs();

        jarFile = new File(jarBuildDir, jarname);
    }

    jar.setInternalDestFile(jarFile);
    jar.execute();

    ZipFileSet zfs = new ZipFileSet();
    zfs.setFile(jarFile);
    zfs.setFullpath(partName + "/" + jarname);

    super.addFileset(zfs);
}
项目:openwonderland    文件:ModuleTask.java   
/**
 * Write SPI Information to JAR. Workaround for ant 1.7 issue
 * writing service to the wrong directory.
 */
private void writeServices(ZipOutputStream zOut) throws IOException {
    Iterator serviceIterator;
    Service service;

    serviceIterator = services.iterator();
    while (serviceIterator.hasNext()) {
        service = (Service) serviceIterator.next();
        //stolen from writeManifest
        super.zipFile(service.getAsStream(), zOut,
                "META-INF/services/" + service.getType(),
                System.currentTimeMillis(), null,
                ZipFileSet.DEFAULT_FILE_MODE);
    }
}
项目:jarjar    文件:AntJarProcessor.java   
private void addParentDirs(String file, ZipOutputStream zOut) throws IOException {
    int slash = file.lastIndexOf('/');
    if (slash >= 0) {
        String dir = file.substring(0, slash);
        if (dirs.add(dir)) {
            addParentDirs(dir, zOut);
            super.zipDir((File) null, zOut, dir + "/", ZipFileSet.DEFAULT_DIR_MODE, JAR_MARKER);
        }
    }
}
项目:ant    文件:Zip.java   
/**
 * Fetch all included and not excluded resources from the sets.
 *
 * <p>Included directories will precede included files.</p>
 * @param filesets an array of filesets
 * @return the resources included
 * @since Ant 1.5.2
 */
protected Resource[][] grabResources(final FileSet[] filesets) {
    final Resource[][] result = new Resource[filesets.length][];
    for (int i = 0; i < filesets.length; i++) {
        boolean skipEmptyNames = true;
        if (filesets[i] instanceof ZipFileSet) {
            final ZipFileSet zfs = (ZipFileSet) filesets[i];
            skipEmptyNames = zfs.getPrefix(getProject()).isEmpty()
                && zfs.getFullpath(getProject()).isEmpty();
        }
        final DirectoryScanner rs =
            filesets[i].getDirectoryScanner(getProject());
        if (rs instanceof ZipScanner) {
            ((ZipScanner) rs).setEncoding(encoding);
        }
        final List<Resource> resources = new Vector<>();
        if (!doFilesonly) {
            for (String d : rs.getIncludedDirectories()) {
                if (!(d.isEmpty() && skipEmptyNames)) {
                    resources.add(rs.getResource(d));
                }
            }
        }
        for (String f : rs.getIncludedFiles()) {
            if (!(f.isEmpty() && skipEmptyNames)) {
                resources.add(rs.getResource(f));
            }
        }
        result[i] = resources.toArray(new Resource[resources.size()]);
    }
    return result;
}
项目:ant    文件:War.java   
/**
 * set the deployment descriptor to use (WEB-INF/web.xml);
 * required unless <tt>update=true</tt>
 * @param descr the deployment descriptor file
 */
public void setWebxml(File descr) {
    deploymentDescriptor = descr;
    if (!deploymentDescriptor.exists()) {
        throw new BuildException("Deployment descriptor:  does not exist.",
            deploymentDescriptor);
    }

    // Create a ZipFileSet for this file, and pass it up.
    ZipFileSet fs = new ZipFileSet();
    fs.setFile(deploymentDescriptor);
    fs.setFullpath(XML_DESCRIPTOR_PATH);
    super.addFileset(fs);
}
项目:ant    文件:Jar.java   
/**
 * Write SPI Information to JAR
 */
private void writeServices(ZipOutputStream zOut) throws IOException {
    for (Service service : serviceList) {
        try (InputStream is = service.getAsStream()) {
            //stolen from writeManifest
           super.zipFile(is, zOut,
                         "META-INF/services/" + service.getType(),
                         System.currentTimeMillis(), null,
                         ZipFileSet.DEFAULT_FILE_MODE);
       }
    }
}
项目:ant    文件:Jar.java   
private void writeManifest(ZipOutputStream zOut, Manifest manifest)
    throws IOException {
    for (Enumeration<String> e = manifest.getWarnings();
         e.hasMoreElements();) {
        log("Manifest warning: " + e.nextElement(),
            Project.MSG_WARN);
    }

    zipDir((Resource) null, zOut, "META-INF/", ZipFileSet.DEFAULT_DIR_MODE,
           JAR_MARKER);
    // time to write the manifest
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OutputStreamWriter osw = new OutputStreamWriter(baos, Manifest.JAR_ENCODING);
    PrintWriter writer = new PrintWriter(osw);
    manifest.write(writer, flattenClassPaths);
    if (writer.checkError()) {
        throw new IOException("Encountered an error writing the manifest");
    }
    writer.close();

    ByteArrayInputStream bais =
        new ByteArrayInputStream(baos.toByteArray());
    try {
        super.zipFile(bais, zOut, MANIFEST_NAME,
                      System.currentTimeMillis(), null,
                      ZipFileSet.DEFAULT_FILE_MODE);
    } finally {
        // not really required
        FileUtils.close(bais);
    }
    super.initZipOutputStream(zOut);
}
项目:ant    文件:Ear.java   
/**
 * File to incorporate as application.xml.
 * @param descr the descriptor file
 */
public void setAppxml(File descr) {
    deploymentDescriptor = descr;
    if (!deploymentDescriptor.exists()) {
        throw new BuildException(
            "Deployment descriptor: %s does not exist.",
            deploymentDescriptor);
    }

    // Create a ZipFileSet for this file, and pass it up.
    ZipFileSet fs = new ZipFileSet();
    fs.setFile(deploymentDescriptor);
    fs.setFullpath(XML_DESCRIPTOR_PATH);
    super.addFileset(fs);
}
项目:ant    文件:Ear.java   
/**
 * Adds zipfileset.
 *
 * @param fs zipfileset to add
 */
public void addArchives(ZipFileSet fs) {
    // We just set the prefix for this fileset, and pass it up.
    // Do we need to do this? LH
    fs.setPrefix("/");
    super.addFileset(fs);
}
项目:tools-idea    文件:Container.java   
protected static LayoutFileSet createCopy(FileSet set) {
    if (set instanceof IdeaModule) {
        return new IdeaModule((IdeaModule) set);
    }
    if (set instanceof IdeaModuleTests) {
        return new IdeaModuleTests((IdeaModuleTests) set);
    }
    if (set instanceof ZipFileSet) {
        return new LayoutFileSet((ZipFileSet) set.clone());
    } else {
        return new LayoutFileSet((FileSet) set.clone());
    }
}
项目:bazel    文件:AntJarProcessor.java   
private void addParentDirs(String file, ZipOutputStream zOut) throws IOException {
    int slash = file.lastIndexOf('/');
    if (slash >= 0) {
        String dir = file.substring(0, slash);
        if (dirs.add(dir)) {
            addParentDirs(dir, zOut);
            super.zipDir((File) null, zOut, dir + "/", ZipFileSet.DEFAULT_DIR_MODE, JAR_MARKER);
        }
    }
}
项目:socomo-maven-plugin    文件:ClassycleTask.java   
protected String[] getClassFileNames()
{
  ArrayList<String> fileNames = new ArrayList<String>();
  String fileSeparator = System.getProperty("file.separator");
  for (ResourceCollection rc : _resources)
  {
    if (!(rc instanceof FileSet)) {
        throw new BuildException("resource collection unsupported " + rc);
    }
    FileSet set = (FileSet) rc;
    DirectoryScanner scanner = set.getDirectoryScanner(getProject());
    String path = scanner.getBasedir().getAbsolutePath();
    String[] localFiles = scanner.getIncludedFiles();
    String separator = fileSeparator;
    if (rc instanceof ZipFileSet)
    {
      ZipFileSet zipFileSet = (ZipFileSet) rc;
      path = zipFileSet.getSrc().getAbsolutePath();
      separator = Parser.ARCHIVE_PATH_DELIMITER;
    }
    for (int j = 0; j < localFiles.length; j++)
    {
      fileNames.add(path + separator + localFiles[j]);
    }
  }
  String[] classFiles = new String[fileNames.size()];
  return (String[]) fileNames.toArray(classFiles);
}
项目:incubator-netbeans    文件:MakeNBM.java   
public ZipFileSet createMain () {
    return (main = new ZipFileSet());
}
项目:incubator-netbeans    文件:Branding.java   
private void packBrandingJar(File srcDir, File destJarBase, String locale) throws IOException {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(srcDir);
    String localeToken = "";
    if(locale != null) {
        String [] includes = {"**/*_" + locale.toString() + ".*"};
        scanner.setIncludes(includes);
        localeToken = "_" + locale.toString();
    } else {
        String [] excludes = {"**/*_??_??.*", "**/*_??.*"};
        scanner.setExcludes(excludes);
    }
    scanner.addDefaultExcludes(); // #68929
    scanner.scan();
    String[] files = scanner.getIncludedFiles();
    if(files.length > 0) {
        Jar zip = (Jar) getProject().createTask("jar");
        String name = destJarBase.getName();
        String nameBase = name.substring(0, name.length() - ".jar".length());
        File destFolder = new File(destJarBase.getParentFile(), "locale");
        if (!destFolder.isDirectory() && !destFolder.mkdirs()) {
            throw new IOException("Could not create directory " + destFolder);
        }
        File destJar = new File(destFolder, nameBase + "_" + token + localeToken + ".jar");
        zip.setDestFile(destJar);
        zip.setCompress(true);
        for (int i = 0; i < files.length; i++) {
            ZipFileSet entry = new ZipFileSet();
            entry.setFile(new File(srcDir, files[i]));
            String basePath = files[i].replace(File.separatorChar, '/');
            int slash = basePath.lastIndexOf('/');
            int dot = basePath.lastIndexOf('.');
            String infix = "_" + token + localeToken;
            String brandedPath;
            if (dot == -1 || dot < slash) {
                brandedPath = basePath + infix;
            } else {
                brandedPath = basePath.substring(0, dot - localeToken.length()) + infix + basePath.substring(dot);
            }
            entry.setFullpath(brandedPath);
            zip.addZipfileset(entry);
        }
        zip.setLocation(getLocation());
        zip.init();
        zip.execute();
    }
}
项目:intellij-ce-playground    文件:JarContainer.java   
public void addMetainf(ZipFileSet fs) {
  ((Jar) task).addMetainf(fs);
}
项目:intellij-ce-playground    文件:Container.java   
public void addZipfileset(ZipFileSet set) {
    children.add(new FileSetContainer(set));
}
项目:intellij-ce-playground    文件:IdeaModuleBase.java   
public IdeaModuleBase(ZipFileSet fileset) {
  super(fileset);
}
项目:intellij-ce-playground    文件:IdeaModuleTests.java   
public IdeaModuleTests(ZipFileSet fileset) {
  super(fileset);
}
项目:intellij-ce-playground    文件:LayoutFileSet.java   
public LayoutFileSet(ZipFileSet fileset) {
    super(fileset);
}
项目:openwonderland    文件:WonderlandPackageTask.java   
public void addChecksumFileset(ZipFileSet fileSet) {
    checksums.add(fileSet);
    addZipfileset(fileSet);
}
项目:openwonderland    文件:WonderlandPackageTask.java   
@Override
public void execute() throws BuildException {
    try {
        if (checksumDir == null) {
            // initialize a temp directory if we don't have one
            checksumDir = File.createTempFile("wonderlandpkg", "files");
            checksumDir.delete();
            checksumDir.mkdir();
            checksumDir.deleteOnExit();
        } else {
            checksumDir.mkdirs();
        }

        Map<String, Map<String, String>> fileLists =
                new HashMap<String, Map<String, String>>();

        // go through each fileset and generate checksums if necessary
        for (ZipFileSet files : checksums) {
            String prefix = files.getPrefix(getProject());
            File fileSetDir = new File(checksumDir, prefix);
            fileSetDir.mkdir();

            // keep track of file names
            Map<String, String> fileChecksums = fileLists.get(prefix);
            if (fileChecksums == null) {
                fileChecksums = new LinkedHashMap<String, String>();
                fileLists.put(prefix, fileChecksums);
            }

            Iterator<FileResource> i = (Iterator<FileResource>) files.iterator();
            while (i.hasNext()) {
                FileResource fr = i.next();
                File f = fr.getFile();

                String writeName = fr.getName().replace(File.separatorChar, '-');
                writeName += ".checksum";
                File checksumFile = new File(fileSetDir, writeName);

                if (!checksumFile.exists() || outOfDate(checksumFile, f)) {
                    generateChecksum(fr, checksumFile);
                }

                String checksum = readChecksum(checksumFile);

                fileChecksums.put(fr.getName(), checksum);
            }
        }

        // write file lists
        for (Map.Entry<String, Map<String, String>> e : fileLists.entrySet()) {
            writeFileList(e.getKey(), e.getValue());
        }

        // add the checksums directory to the jar
        ZipFileSet zfs = new ZipFileSet();
        zfs.setDir(checksumDir);
        FilenameSelector fs = new FilenameSelector();
        fs.setName("**/files.list");
        zfs.add(fs);
        zfs.setPrefix("META-INF");
        addFileset(zfs);
    } catch (IOException ioe) {
        throw new BuildException(ioe);
    }

    super.execute();
}
项目:ant    文件:War.java   
/**
 * add files under WEB-INF/lib/
 * @param fs the zip file set to add
 */
public void addLib(ZipFileSet fs) {
    // We just set the prefix for this fileset, and pass it up.
    fs.setPrefix("WEB-INF/lib/");
    super.addFileset(fs);
}
项目:ant    文件:War.java   
/**
 * add files under WEB-INF/classes
 * @param fs the zip file set to add
 */
public void addClasses(ZipFileSet fs) {
    // We just set the prefix for this fileset, and pass it up.
    fs.setPrefix("WEB-INF/classes/");
    super.addFileset(fs);
}
项目:ant    文件:War.java   
/**
 * files to add under WEB-INF;
 * @param fs the zip file set to add
 */
public void addWebinf(ZipFileSet fs) {
    // We just set the prefix for this fileset, and pass it up.
    fs.setPrefix("WEB-INF/");
    super.addFileset(fs);
}
项目:ant    文件:Jar.java   
/**
 * Adds a zipfileset to include in the META-INF directory.
 *
 * @param fs zipfileset to add
 */
public void addMetainf(ZipFileSet fs) {
    // We just set the prefix for this fileset, and pass it up.
    fs.setPrefix("META-INF/");
    super.addFileset(fs);
}
项目:ant    文件:Jar.java   
/**
 * Create the index list to speed up classloading.
 * This is a JDK 1.3+ specific feature and is enabled by default. See
 * <a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Index">
 * the JAR index specification</a> for more details.
 *
 * @param zOut the zip stream representing the jar being built.
 * @throws IOException thrown if there is an error while creating the
 * index and adding it to the zip stream.
 */
private void createIndexList(ZipOutputStream zOut) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    // encoding must be UTF8 as specified in the specs.
    PrintWriter writer = new PrintWriter(new OutputStreamWriter(baos,
                                                                "UTF8"));

    // version-info blankline
    writer.println("JarIndex-Version: 1.0");
    writer.println();

    // header newline
    writer.println(zipFile.getName());

    writeIndexLikeList(new ArrayList<String>(addedDirs.keySet()),
                       rootEntries, writer);
    writer.println();

    if (indexJars != null) {
        Manifest mf = createManifest();
        Manifest.Attribute classpath =
            mf.getMainSection().getAttribute(Manifest.ATTRIBUTE_CLASSPATH);
        String[] cpEntries = null;
        if (classpath != null && classpath.getValue() != null) {
            StringTokenizer tok = new StringTokenizer(classpath.getValue(),
                                                      " ");
            cpEntries = new String[tok.countTokens()];
            int c = 0;
            while (tok.hasMoreTokens()) {
                cpEntries[c++] = tok.nextToken();
            }
        }
        String[] indexJarEntries = indexJars.list();
        for (int i = 0; i < indexJarEntries.length; i++) {
            String name = findJarName(indexJarEntries[i], cpEntries);
            if (name != null) {
                ArrayList<String> dirs = new ArrayList<String>();
                ArrayList<String> files = new ArrayList<String>();
                grabFilesAndDirs(indexJarEntries[i], dirs, files);
                if (dirs.size() + files.size() > 0) {
                    writer.println(name);
                    writeIndexLikeList(dirs, files, writer);
                    writer.println();
                }
            }
        }
    }

    if (writer.checkError()) {
        throw new IOException("Encountered an error writing jar index");
    }
    writer.close();
    try (ByteArrayInputStream bais =
        new ByteArrayInputStream(baos.toByteArray())) {
        super.zipFile(bais, zOut, INDEX_NAME, System.currentTimeMillis(),
                      null, ZipFileSet.DEFAULT_FILE_MODE);
    }
}
项目:tools-idea    文件:JarContainer.java   
public void addMetainf(ZipFileSet fs) {
  ((Jar) task).addMetainf(fs);
}
项目:tools-idea    文件:Container.java   
public void addZipfileset(ZipFileSet set) {
    children.add(new FileSetContainer(set));
}