List of usage examples for org.apache.commons.io FileUtils forceMkdir
public static void forceMkdir(File directory) throws IOException
From source file:com.vmware.demo.sgf.lucene.LuceneIndexRepoFactory.java
/** * Create the index directory also remove the write.lock file if it exists. * //from ww w . j av a 2s .c om * @throws IOException */ private static void createIndexDirectory() throws IOException { FileUtils.forceMkdir(new File(indexDirectory)); FileUtils.deleteQuietly(new File(indexDirectory + "/write.lock")); }
From source file:edu.cornell.med.icb.goby.alignments.perms.TestQueryIndexPermutation.java
@BeforeClass public static void setUp() throws IOException { FileUtils.forceMkdir(new File("test-results/permutations")); }
From source file:edu.cornell.med.icb.goby.reads.TestReadSet.java
@BeforeClass public static void initializeTestDirectory() throws IOException { FileUtils.forceMkdir(new File("test-results/read-sets")); }
From source file:es.urjc.mctwp.bbeans.research.SessionUtils.java
public static File getOrCreateFile(String base, String fileName) { String aux = null;/*from ww w . j a v a2s. c om*/ File auxDir = null; aux = FilenameUtils.concat(base, fileName); auxDir = new File(aux); try { if (!auxDir.exists()) FileUtils.forceMkdir(auxDir); } catch (Exception e) { logger.error("Could not make temp directory for thumbnails: " + e.getMessage()); } return auxDir; }
From source file:com.opengamma.util.ZipUtils.java
/** * Unzips a ZIP archive.//from w ww.j a v a2 s. c om * * @param archive the archive file, not null * @param outputDir the output directory, not null */ public static void unzipArchive(final File archive, final File outputDir) { ArgumentChecker.notNull(archive, "archive"); ArgumentChecker.notNull(outputDir, "outputDir"); s_logger.debug("Unzipping file:{} to {}", archive, outputDir); try { FileUtils.forceMkdir(outputDir); unzipArchive(new ZipFile(archive), outputDir); } catch (Exception ex) { throw new OpenGammaRuntimeException("Error while extracting file: " + archive + " to: " + outputDir, ex); } }
From source file:com.hp.autonomy.frontend.find.core.test.AbstractFindIT.java
@BeforeClass public static void init() throws IOException { System.setProperty("hp.find.home", TEST_DIR); final File directory = new File(TEST_DIR); FileUtils.forceMkdir(directory); }
From source file:eu.planets_project.services.utils.ZipUtilsTest.java
/** * @throws java.lang.Exception//from w w w. j av a 2 s. c o m */ @BeforeClass public static void setUpBeforeClass() throws Exception { outputFolder = new File(DigitalObjectUtils.SYSTEM_TEMP_DIR, "ZipUtils_Test_Tmp".toUpperCase()); FileUtils.forceMkdir(outputFolder); extractResultOut = new File(outputFolder, "EXTRACTED"); FileUtils.forceMkdir(extractResultOut); FileUtils.cleanDirectory(outputFolder); zip = ZipUtils.createZip(TEST_FILE_FOLDER, outputFolder, TEST_FILE_FOLDER.getName() + ".zip", false); }
From source file:de.tudarmstadt.ukp.dkpro.keyphrases.bookindexing.util.SerializationUtils.java
/** * @param object//from w ww . jav a 2s. c om * object to be serialized * @param filePath * the object will be written at this location, directories will be * created according to path * @throws Exception exception */ public static void serializeToDisk(Serializable object, String filePath) throws Exception { File dir = new File(FilenameUtils.getFullPathNoEndSeparator(filePath)); if (!dir.exists()) { FileUtils.forceMkdir(dir); } else { if (dir.isFile()) { throw new IOException("Path to dir is a file!"); } } ObjectOutputStream objOut = null; objOut = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(filePath))); objOut.writeObject(object); objOut.flush(); objOut.close(); }
From source file:com.baifendian.swordfish.execserver.utils.EnvHelper.java
/** * /* w w w .j a v a2 s. c o m*/ * * @param execLocalPath * @param proxyUser * @param logger * @throws IOException */ public static void workDirAndUserCreate(String execLocalPath, String proxyUser, Logger logger) throws IOException { // , File execLocalPathFile = new File(execLocalPath); if (execLocalPathFile.exists()) { FileUtils.forceDelete(execLocalPathFile); } // FileUtils.forceMkdir(execLocalPathFile); // proxyUser ?, ? List<String> osUserList = OsUtil.getUserList(); // ?, if (!osUserList.contains(proxyUser)) { String userGroup = OsUtil.getGroup(); if (StringUtils.isNotEmpty(userGroup)) { logger.info("create os user:{}", proxyUser); String cmd = String.format("sudo useradd -g %s %s", userGroup, proxyUser); logger.info("exec cmd: {}", cmd); OsUtil.exeCmd(cmd); } } }
From source file:edu.cornell.med.icb.goby.reads.TestReadsWriter.java
@BeforeClass public static void setUp() throws IOException { FileUtils.forceMkdir(new File("test-results/reads")); }