Search code examples
synchronousjava-iofileutils

Do the methods in Apache's FileUtils peform synchronous (blocking) i/o?


Do the methods in Apache's FileUtils perform synchronous (blocking) i/o?

I am making a call to FileUtils.copyDirectoryToDirectory. In my next line, I want to delete the directory that I copied.

Example:

FileUtils.copyDirectoryToDirectory(source, destination);
FileUtils.deleteDirectory(source);

Just want to make sure this is "safe" and asynchronous (non-blocking) i/o isn't happening.

Thanks.


Solution

  • Two things:

    1. FileUtils is not part of the standard JDK, it a class in the Apache Commons IO library.
    2. The operations you mentioned do not use non-blocking IO.

    So to answer your question, yes, your overall operation is safe.