@Override public void run() { _cleaner.clean(); } }
protected void writePidFile(File pidFile, long pid) throws IOException { Files.write(pid + "\n", pidFile); } }
public static File createTempFile(File tempDir, String tempFileName) throws IOException, FileAlreadyExistsException { File tempFile = fileOf(tempDir, tempFileName); createOrCheckDir(tempFile.getParentFile()); if (!tempFile.createNewFile()) throw new FileAlreadyExistsException("could not create",tempFile); return tempFile; }
public static boolean forceDelete(final File fileOrDir) { boolean ret = false; try { if ((fileOrDir != null) && (fileOrDir.exists())) { forceDelete(fileOrDir.toPath()); logger.debug("could delete {}", fileOrDir); ret = true; } } catch (IOException e) { logger.warn("could not delete {}. Will try to delete it again when program exits.", fileOrDir); FileCleaner.forceDeleteOnExit(fileOrDir); ret = true; } return ret; }
public synchronized static void forceDeleteOnExit(File fileOrDir) { // FileUtils.forceDeleteOnExit(file); if (cleaner == null) { cleaner = new Cleaner(); Thread cleanerThread = new Thread(new CleanerThreadRunner(cleaner)); cleanerThread.setDaemon(true); cleanerThread.start(); Runtime.getRuntime().addShutdownHook(new Thread(new CleanerShutdownHook(cleaner))); } cleaner.forceDelete(fileOrDir); }
public static File createTempDir(IDirectory directory, String prefix) throws IOException { File tempDir = directory.asFile(); return createTempDir(tempDir, prefix); }
@Override public File asFile() { return Files.fileOf(left.asFile(), right.asFile()); } };
public static File createOrCheckDir(String dir) throws IOException { File tempFile = new File(dir); return createOrCheckDir(tempFile); }
public static File createOrCheckDir(File dir) throws IOException { if ((dir.exists()) && (dir.isDirectory())) return dir; return createDir(dir); }
public static File createTempFile(IDirectory directory, String tempFileName) throws IOException { File tempDir = directory.asFile(); return createTempFile(tempDir, tempFileName); }
public static File createTempFile(File tempDir, String tempFileName) throws IOException { File tempFile = fileOf(tempDir, tempFileName); createOrCheckDir(tempFile.getParentFile()); if (!tempFile.createNewFile()) throw new FileAlreadyExistsException("could not create",tempFile); return tempFile; }
public static boolean forceDelete(final File fileOrDir) { boolean ret = false; try { if ((fileOrDir != null) && (fileOrDir.exists())) { forceDelete(fileOrDir.toPath()); logger.debug("could delete {}", fileOrDir); ret = true; } } catch (IOException e) { logger.warn("could not delete {}. Will try to delete it again when program exits.", fileOrDir); FileCleaner.forceDeleteOnExit(fileOrDir); ret = true; } return ret; }
public synchronized static void forceDeleteOnExit(File fileOrDir) { // FileUtils.forceDeleteOnExit(file); if (cleaner == null) { cleaner = new Cleaner(); Thread cleanerThread = new Thread(new CleanerThreadRunner(cleaner)); cleanerThread.setDaemon(true); cleanerThread.start(); Runtime.getRuntime().addShutdownHook(new Thread(new CleanerShutdownHook(cleaner))); } cleaner.forceDelete(fileOrDir); }
public static File createTempDir(Directory directory, String prefix) throws IOException { File tempDir = directory.asFile(); return createTempDir(tempDir, prefix); }
@Override public File asFile() { return Files.fileOf(left.asFile(), right.asFile()); } };
public static File createOrCheckDir(String dir) throws IOException { File tempFile = new File(dir); return createOrCheckDir(tempFile); }
protected void writePidFile(File pidFile, long pid) throws IOException { Files.write(pid + "\n", pidFile); } }
public static File createOrCheckDir(File dir) throws IOException { if ((dir.exists()) && (dir.isDirectory())) return dir; return createDir(dir); }
public static File createTempFile(Directory directory, String tempFileName) throws IOException { File tempDir = directory.asFile(); return createTempFile(tempDir, tempFileName); }
@Override public void run() { _cleaner.clean(); } }