Package org.apache.tools.ant.types

Examples of org.apache.tools.ant.types.Resource


        Iterator i = rc.iterator();
        if (!i.hasNext()) {
            return null;

        }
        Resource xest = (Resource) i.next();
        while (i.hasNext()) {
            Resource next = (Resource) i.next();
            if (c.compare(xest, next) < 0) {
                xest = next;
            }
        }
        return xest;
View Full Code Here


                expandFile(FILE_UTILS, source, dest);
            }
        }
        Iterator iter = resources.iterator();
        while (iter.hasNext()) {
            Resource r = (Resource) iter.next();
            if (!r.isExists()) {
                continue;
            }

            if (r instanceof FileResource) {
                expandFile(FILE_UTILS, ((FileResource) r).getFile(), dest);
View Full Code Here

                          files);
            }
        } else { // non-file resources
            Iterator iter = rc.iterator();
            while (upToDate && iter.hasNext()) {
                Resource r = (Resource) iter.next();
                upToDate = archiveIsUpToDate(r);
            }
        }
        return upToDate;
    }
View Full Code Here

                tarFile(f, tOut, f.getName(), tfs);
            }
        } else { // non-file resources
            Iterator iter = rc.iterator();
            while (iter.hasNext()) {
                Resource r = (Resource) iter.next();
                tarResource(r, tOut, r.getName(), tfs);
            }
        }
    }
View Full Code Here

     */
    private String[] getFilenames() {
        Vector v = new Vector();
        Iterator iter = resources.iterator();
        while (iter.hasNext()) {
            Resource r = (Resource) iter.next();
            if (r.isExists()) {
                String pathname = r.getName();
                if (pathname.endsWith(".java")) {
                    v.addElement(pathname.substring(0, pathname.length() - ".java".length()));
                } else if (pathname.endsWith(".class")) {
                    v.addElement(pathname.substring(0, pathname.length() - ".class".length()));
                }
View Full Code Here

    private boolean isUpToDate(ResourceCollection c) {
        if (destinationFile == null || forceOverwrite) {
            return false;
        }
        for (Iterator i = c.iterator(); i.hasNext();) {
            Resource r = (Resource) i.next();
            if (r.getLastModified() == 0L
                 || r.getLastModified() > destinationFile.lastModified()) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

     * @since Ant 1.7
     */
    private void processResources(Resource stylesheet) {
        Iterator iter = resources.iterator();
        while (iter.hasNext()) {
            Resource r = (Resource) iter.next();
            if (!r.isExists()) {
                continue;
            }
            File base = baseDir;
            String name = r.getName();
            if (r instanceof FileResource) {
                FileResource f = (FileResource) r;
                base = f.getBaseDir();
                if (base == null) {
                    name = f.getFile().getAbsolutePath();
View Full Code Here

        }
        String name = getName();
        if (name == null) {
            throw new BuildException("entry name not set");
        }
        Resource r = getArchive();
        if (r == null) {
            throw new BuildException("archive attribute not set");
        }
        if (!r.isExists()) {
            throw new BuildException(r.toString() + " does not exist.");
        }
        if (r.isDirectory()) {
            throw new BuildException(r + " denotes a directory.");
        }
        fetchEntry();
        haveEntry = true;
    }
View Full Code Here

     */
    public InputStream getInputStream() throws IOException {
        if (isReference()) {
            return ((Resource) getCheckedRef()).getInputStream();
        }
        Resource archive = getArchive();
        final TarInputStream i = new TarInputStream(archive.getInputStream());
        TarEntry te = null;
        while ((te = i.getNextEntry()) != null) {
            if (te.getName().equals(getName())) {
                return i;
            }
View Full Code Here

    /**
     * fetches information from the named entry inside the archive.
     */
    protected void fetchEntry() {
        Resource archive = getArchive();
        TarInputStream i = null;
        try {
            i = new TarInputStream(archive.getInputStream());
            TarEntry te = null;
            while ((te = i.getNextEntry()) != null) {
                if (te.getName().equals(getName())) {
                    setEntry(te);
                    return;
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.