Codota Logo
FileUtils
Code IndexAdd Codota to your IDE (free)

How to use
FileUtils
in
de.otto.jlineup.file

Best Java code snippets using de.otto.jlineup.file.FileUtils (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: de.otto/jlineup-core

public static void deleteDirectory(String path) throws IOException {
  deleteDirectory(Paths.get(path));
}
origin: de.otto/jlineup-core

public static void deleteDirectory(Path path) throws IOException {
  clearDirectory(path.toString());
  Files.deleteIfExists(path);
}
origin: otto-de/jlineup

@Test
public void shouldDeleteDirectory() throws IOException {
  //given
  final Path dirToDelete = Files.createTempDirectory("jlineup-fileutils-test");
  Files.createDirectories(dirToDelete.resolve("one/two/three"));
  //when
  deleteDirectory(dirToDelete);
  //then
  assertThat(Files.exists(dirToDelete), is(false));
}
origin: de.otto/jlineup-core

private void createOrClearDirectoryBelowWorkingDir(String workingDirectory, String subDirectory) throws IOException {
  try {
    final String subDirectoryPath = workingDirectory + "/" + subDirectory;
    createDirIfNotExists(subDirectoryPath);
    clearDirectory(subDirectoryPath);
  } catch (IOException e) {
    throw new IOException("Could not create or open " + subDirectory + " directory.", e);
  }
}
origin: otto-de/jlineup

@After
public void cleanUp() throws IOException {
  FileUtils.deleteDirectory(tempJLineupDirectory);
}
origin: de.otto/jlineup-core

public static void clearDirectory(String path) throws IOException {
  Path directory = Paths.get(path);
  Files.newDirectoryStream(directory).forEach(file -> {
    try {
      if (Files.isDirectory(file)) {
        clearDirectory(file.toAbsolutePath().toString());
      }
      Files.delete(file);
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  });
}
origin: otto-de/jlineup

@After
public void cleanup() throws IOException {
  FileUtils.deleteDirectory(tempDirectory);
}
origin: otto-de/jlineup

@Test
public void shouldClearDirectory() throws IOException {
  //given
  final Path dirToClear = Files.createTempDirectory("jlineup-fileutils-test");
  Files.createFile(dirToClear.resolve(Paths.get("test1")));
  Files.createFile(dirToClear.resolve(Paths.get("test2")));
  Files.createFile(dirToClear.resolve(Paths.get("test3")));
  //when
  clearDirectory(dirToClear.toString());
  //then
  assertThat(dirToClear.toFile().list().length, is(0));
  Files.delete(dirToClear);
}
de.otto.jlineup.fileFileUtils

Most used methods

  • deleteDirectory
  • clearDirectory

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now