public final class IoUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
IoUtils.IoRunnable
Like
Runnable, but with a throwable IOException. |
static class |
IoUtils.RetryFailedException |
| Constructor and Description |
|---|
IoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
retryIfAccessDenied(java.lang.String name,
IoUtils.IoRunnable r)
Run an IO operation and retry it (at most
maxRetries retries) if it
fails with AccessDeniedException. |
static void |
retryIfAccessDenied(java.lang.String name,
IoUtils.IoRunnable r,
int maxRetries,
long retryDelay,
java.util.concurrent.TimeUnit delayUnit) |
static java.lang.String |
tempConfigFileName(java.nio.file.Path originalFile)
Generates a filename (not path) for a temporary config file, for use with
WritingMode.REPLACE_ATOMIC. |
public static java.lang.String tempConfigFileName(java.nio.file.Path originalFile)
WritingMode.REPLACE_ATOMIC.
Tries to keep the extension of the original file, to make it easier to find config files and to add them to
file scanning whitelist (see the issue related to Windows Defender locking config files).originalFile - the original config filepublic static void retryIfAccessDenied(java.lang.String name,
IoUtils.IoRunnable r)
throws java.io.IOException
maxRetries retries) if it
fails with AccessDeniedException.
See https://github.com/TheElectronWill/night-config/issues/183.name - a name to print in error messagesr - the operation to runjava.io.IOException - if it fails after retrying too many times, or for an error other than AccessDeniedExceptionpublic static void retryIfAccessDenied(java.lang.String name,
IoUtils.IoRunnable r,
int maxRetries,
long retryDelay,
java.util.concurrent.TimeUnit delayUnit)
throws java.io.IOException
java.io.IOException