List of usage examples for org.apache.commons.io FileUtils forceDelete
public static void forceDelete(File file) throws IOException
From source file:com.redhat.victims.mock.MockEnvironment.java
public static void initCache() throws IOException { TEMP_CACHE = File.createTempFile(CACHE_PREFIX, ""); FileUtils.forceDelete(TEMP_CACHE); }
From source file:com.jivesoftware.os.jive.utils.shell.utils.Unzip.java
public static File unGzip(boolean verbose, File outputDir, String outName, File inputFile, boolean deleteOriginal) throws FileNotFoundException, IOException { String inFilePath = inputFile.getAbsolutePath(); if (verbose) { System.out.println("unzipping " + inFilePath); }//from w w w. jav a 2 s.c o m GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(inFilePath)); File outFile = new File(outputDir, outName); outFile.getParentFile().mkdirs(); String outFilePath = outFile.getAbsolutePath(); OutputStream out = new FileOutputStream(outFilePath); byte[] buf = new byte[1024]; int len; while ((len = gzipInputStream.read(buf)) > 0) { out.write(buf, 0, len); } gzipInputStream.close(); out.close(); if (deleteOriginal) { FileUtils.forceDelete(inputFile); if (verbose) { System.out.println(String.format("deleted original file %s.", inputFile.getAbsolutePath())); } } if (verbose) { System.out.println("unzipped " + inFilePath); } return new File(outFilePath); }
From source file:net.orfjackal.dimdwarf.testutils.SandboxTest.java
@After public void deleteParentDir() throws IOException { FileUtils.forceDelete(sandboxDir); }
From source file:com.alexholmes.hadooputils.TestBase.java
@Before public void before() throws IOException { if (TEST_ROOT_DIR.exists()) { FileUtils.forceDelete(TEST_ROOT_DIR); }/* w ww.j a va2s . co m*/ FileUtils.forceMkdir(TEST_ROOT_DIR); }
From source file:net.paissad.jcamstream.utils.PropertiesConfTest.java
@AfterClass public static void tearDownAfterClass() throws Exception { if (tempFile != null && tempFile.exists()) FileUtils.forceDelete(tempFile); }
From source file:io.proscript.jlight.CacheManager.java
public void initialize() throws IOException { if (this.environment.getCacheDirectory().exists()) { FileUtils.forceDelete(this.environment.getCacheDirectory()); }/*from ww w.j ava 2 s . c o m*/ this.environment.getCacheDirectory().mkdir(); }
From source file:com.opengamma.transport.TaxonomyGatheringFudgeMessageSenderTest.java
public void noTaxonomyFileAvailableYet() throws IOException { File tmpFile = File.createTempFile("TaxonomyGatheringFudgeMessageSenderTest_noTaxonomyFileAvailableYet", ".properties"); FileUtils.forceDelete(tmpFile); FileUtils.forceDeleteOnExit(tmpFile); FudgeContext context = new FudgeContext(); CollectingFudgeMessageReceiver collectingReceiver = new CollectingFudgeMessageReceiver(); ByteArrayFudgeMessageReceiver fudgeReceiver = new ByteArrayFudgeMessageReceiver(collectingReceiver); DirectInvocationByteArrayMessageSender byteArraySender = new DirectInvocationByteArrayMessageSender( fudgeReceiver);//from ww w . java2 s . c o m ByteArrayFudgeMessageSender fudgeSender = new ByteArrayFudgeMessageSender(byteArraySender, context); TaxonomyGatheringFudgeMessageSender gatheringSender = new TaxonomyGatheringFudgeMessageSender(fudgeSender, tmpFile.getAbsolutePath()); assertTrue(gatheringSender.getCurrentTaxonomy().isEmpty()); }
From source file:com.silverpeas.directory.servlets.ImageProfilTest.java
@AfterClass public static void cleanDir() throws IOException { FileUtils.forceDelete(new File(TEMP_DIRECTORY)); }
From source file:com.kegare.caveworld.plugin.mceconomy.ShopEntry.java
@Override public void setToDefault() { try {/*from w ww . j av a2s. c o m*/ FileUtils.forceDelete(new File(MCEconomyPlugin.shopCfg.toString())); } catch (IOException e) { e.printStackTrace(); return; } ShopProductManager.instance().clearShopProducts(); MCEconomyPlugin.shopCfg = null; MCEconomyPlugin.syncShopCfg(); if (childScreen instanceof GuiShopEntry) { GuiShopEntry gui = (GuiShopEntry) childScreen; if (gui.productList != null) { gui.productList.products.clear(); gui.productList.products.addAll(ShopProductManager.instance().getShopProducts()); gui.productList.contents.clear(); gui.productList.contents.addAll(gui.productList.products); } } }
From source file:com.alexholmes.hadooputils.TestBase.java
@After public void after() throws IOException { if (TEST_ROOT_DIR.exists()) { FileUtils.forceDelete(TEST_ROOT_DIR); } }