当前位置: 首页>>代码示例>>Java>>正文


Java Delete类代码示例

本文整理汇总了Java中org.apache.tools.ant.taskdefs.Delete的典型用法代码示例。如果您正苦于以下问题:Java Delete类的具体用法?Java Delete怎么用?Java Delete使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Delete类属于org.apache.tools.ant.taskdefs包,在下文中一共展示了Delete类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unZip

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
public static void unZip(String zipPath,String targetFolder,boolean cleanZip){
	File folderFile =new File(targetFolder);
	File zipFile = new File(zipPath);
	Project prj = new Project();
	Expand expand = new Expand();
	expand.setEncoding("UTF-8");
	expand.setProject(prj);
	expand.setSrc(zipFile);
	expand.setOverwrite(true);
	expand.setDest(folderFile);
	expand.execute();
	
	if(cleanZip){
		//清除zip包
		Delete delete = new Delete();
		delete.setProject(prj);
		delete.setDir(zipFile);
		delete.execute();
	}
}
 
开发者ID:yulele166,项目名称:pub-service,代码行数:21,代码来源:FileUtil.java

示例2: execute

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
public void execute() throws Exception {
    Delete t = new Delete();
    t.setDir( project.getAntOutputDir() );
    antTaskRunner.runTask( t );

    File header = project.getDeployHeaderFile();
    boolean del = header.delete();
    System.out.println( "Delete header file=" + del );

    File[] files = project.getDeployDir().listFiles( new FileFilter() {
        public boolean accept( File pathname ) {
            return !pathname.isDirectory();
        }
    } );
    for ( int i = 0; i < files.length; i++ ) {
        File file = files[i];
        boolean deleted = file.delete();
        System.out.println( "Delete " + file + " = " + deleted );
    }

    Delete d = new Delete();
    d.setDir( project.getContribLicenseDir() );
    antTaskRunner.runTask( d );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:PhetCleanCommand.java

示例3: delDir

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
static public void delDir(File dir) {
	final class AntDelete extends Delete {
		@SuppressWarnings("deprecation")
		public AntDelete() {
			project = new Project();
			project.init();
			taskType = "delete";
			taskName = "delete";
			target = new Target();
		}
	}

	AntDelete ant = new AntDelete();
	ant.setDir(dir);
	ant.execute();
}
 
开发者ID:AbnerLin,项目名称:PLWeb-Destop-Version,代码行数:17,代码来源:AntTask.java

示例4: recursivelyDeleteDir

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
/**
 * Delete a directory and all subdirectories
 */
public static void recursivelyDeleteDir(File customProfileDir) {
	if (customProfileDir == null || !customProfileDir.exists()) {
		return;
	}
	Delete delete = new Delete();
	delete.setProject(new Project());
	delete.setDir(customProfileDir);
	delete.setFailOnError(true);
	delete.execute();
}
 
开发者ID:epam,项目名称:Wilma,代码行数:14,代码来源:LauncherUtils.java

示例5: testWithoutPreviousResolveAndNonDefaultCache

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
@Test
public void testWithoutPreviousResolveAndNonDefaultCache() {
    File cache2 = new File("build/cache2");
    cache2.mkdirs();

    try {
        project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
        fileset.setSetid("simple-setid");
        System.setProperty("ivy.cache.dir", cache2.getAbsolutePath());
        fileset.execute();
        Object ref = project.getReference("simple-setid");
        assertNotNull(ref);
        assertTrue(ref instanceof FileSet);
        FileSet fs = (FileSet) ref;
        DirectoryScanner directoryScanner = fs.getDirectoryScanner(project);
        assertEquals(1, directoryScanner.getIncludedFiles().length);
        assertEquals(
            getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar", cache2)
                    .getAbsolutePath(), new File(directoryScanner.getBasedir(),
                    directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
    } finally {
        Delete del = new Delete();
        del.setProject(new Project());
        del.setDir(cache2);
        del.execute();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:28,代码来源:IvyCacheFilesetTest.java

示例6: tearDown

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
@After
public void tearDown() {
    TestHelper.cleanCache();
    Delete del = new Delete();
    del.setProject(new Project());
    del.setDir(new File("build/test/retrieve"));
    del.execute();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:9,代码来源:RetrieveTest.java

示例7: tearDown

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
@After
public void tearDown() {
    IvyContext.popContext();
    Delete del = new Delete();
    del.setProject(new Project());
    del.setDir(cacheManager.getRepositoryCacheRoot());
    del.execute();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:9,代码来源:DefaultRepositoryCacheManagerTest.java

示例8: clean

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
private void clean(File tempDirectory) {
	Delete cleanupTask = new Delete();
	cleanupTask.setProject(getProject());
	cleanupTask.setTaskName(getTaskName());
	cleanupTask.setLocation(getLocation());
	cleanupTask.setDir(tempDirectory);
	cleanupTask.perform();
}
 
开发者ID:rednoah,项目名称:ant-spk,代码行数:9,代码来源:PackageTask.java

示例9: getTimeDiff

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
/**
 * auto find the time difference between local and remote
 * @param ftp handle to ftp client
 * @return number of millis to add to remote time to make it comparable to local time
 * @since ant 1.6
 */
private long getTimeDiff(FTPClient ftp) {
    long returnValue = 0;
    File tempFile = findFileName(ftp);
    try {
        // create a local temporary file
        FILE_UTILS.createNewFile(tempFile);
        long localTimeStamp = tempFile.lastModified();
        BufferedInputStream instream = new BufferedInputStream(Files.newInputStream(tempFile.toPath()));
        ftp.storeFile(tempFile.getName(), instream);
        instream.close();
        if (FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
            FTPFile [] ftpFiles = ftp.listFiles(tempFile.getName());
            if (ftpFiles.length == 1) {
                long remoteTimeStamp = ftpFiles[0].getTimestamp().getTime().getTime();
                returnValue = localTimeStamp - remoteTimeStamp;
            }
            ftp.deleteFile(ftpFiles[0].getName());
        }
        // delegate the deletion of the local temp file to the delete task
        // because of race conditions occurring on Windows
        Delete mydelete = new Delete();
        mydelete.bindToOwner(task);
        mydelete.setFile(tempFile.getCanonicalFile());
        mydelete.execute();
    } catch (Exception e) {
        throw new BuildException(e, task.getLocation());
    }
    return returnValue;
}
 
开发者ID:apache,项目名称:ant,代码行数:36,代码来源:FTPTaskMirrorImpl.java

示例10: getTimeDiff

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
/**
 * auto find the time difference between local and remote
 * @param ftp handle to ftp client
 * @return number of millis to add to remote time to make it comparable to local time
 * @since ant 1.6
 */
private long getTimeDiff(FTPClient ftp) {
    long returnValue = 0;
    File tempFile = findFileName(ftp);
    try {
        // create a local temporary file
        FILE_UTILS.createNewFile(tempFile);
        long localTimeStamp = tempFile.lastModified();
        BufferedInputStream instream = new BufferedInputStream(Files.newInputStream(tempFile.toPath()));
        ftp.storeFile(tempFile.getName(), instream);
        instream.close();
        boolean success = FTPReply.isPositiveCompletion(ftp.getReplyCode());
        if (success) {
            FTPFile [] ftpFiles = ftp.listFiles(tempFile.getName());
            if (ftpFiles.length == 1) {
                long remoteTimeStamp = ftpFiles[0].getTimestamp().getTime().getTime();
                returnValue = localTimeStamp - remoteTimeStamp;
            }
            ftp.deleteFile(ftpFiles[0].getName());
        }
        // delegate the deletion of the local temp file to the delete task
        // because of race conditions occurring on Windows
        Delete mydelete = new Delete();
        mydelete.bindToOwner(this);
        mydelete.setFile(tempFile.getCanonicalFile());
        mydelete.execute();
    } catch (Exception e) {
        throw new BuildException(e, getLocation());
    }
    return returnValue;
}
 
开发者ID:apache,项目名称:ant,代码行数:37,代码来源:FTP.java

示例11: maybeClearLocalRepo

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
/**
 * If setup with a local repo, clean it
 */
private void maybeClearLocalRepo() {
    File basedir = getLocalRepoBaseDir();
    if (basedir == null) {
        return;
    }

    log("Deleting the local repository '" + basedir + "'", Project.MSG_VERBOSE);

    Delete delete = new Delete();
    delete.setFailOnError(false);
    delete.setDir(basedir);
}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:16,代码来源:ImportAntscripts.java

示例12: deleteDir

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
private static void deleteDir(Project project, File dir) {
	Delete deleteTask = new Delete();
	deleteTask.setProject(project);
	deleteTask.setTaskName("delete dir");
	deleteTask.setDir(dir);
	deleteTask.execute();
}
 
开发者ID:th-schwarz,项目名称:pmcms,代码行数:8,代码来源:InternalAntTool.java

示例13: deleteFile

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
private static void deleteFile(Project project, File file) {
	Delete deleteTask = new Delete();
	deleteTask.setProject(project);
	deleteTask.setTaskName("delete file");
	deleteTask.setFile(file);
	deleteTask.execute();
}
 
开发者ID:th-schwarz,项目名称:pmcms,代码行数:8,代码来源:InternalAntTool.java

示例14: cleanupTestDir

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
@After
public void cleanupTestDir() {
        Delete delete = new Delete();
        delete.setProject(new Project());
        delete.setDir(testDir);
        delete.setQuiet(true);
        delete.setIncludeEmptyDirs(true);
        delete.execute();
}
 
开发者ID:rimerosolutions,项目名称:ant-wrapper,代码行数:10,代码来源:InstallerTest.java

示例15: deleteFolder

import org.apache.tools.ant.taskdefs.Delete; //导入依赖的package包/类
public static void deleteFolder(File folder) {
        if (folder.exists()) {
                Delete delete = new Delete();
                delete.setProject(new Project());
                delete.setDir(folder);
                delete.setIncludeEmptyDirs(true);
                delete.setQuiet(true);
                delete.execute();
        }
}
 
开发者ID:rimerosolutions,项目名称:ant-wrapper,代码行数:11,代码来源:IOUtils.java


注:本文中的org.apache.tools.ant.taskdefs.Delete类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。