public final class OfficeUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteOrRenameFile(@NonNull File file,
long interval,
long timeout)
Deletes a file with a fallback (renaming) on deletion failure.
|
static @NonNull File |
getDefaultWorkingDir()
Gets the default working directory, which is the java.io.tmpdir system property.
|
static void |
stopQuietly(@Nullable OfficeManager manager)
Stops an
OfficeManager unconditionally. |
static void |
validateWorkingDir(@NonNull File workingDir)
Validates that the specified File instance is a valid working directory.
|
public static @NonNull File getDefaultWorkingDir()
File instance that is default working directory.public static void validateWorkingDir(@NonNull File workingDir)
workingDir - The directory to validate.IllegalStateException - If the specified directory if not a valid working directory.public static void stopQuietly(@Nullable OfficeManager manager)
OfficeManager unconditionally.
Equivalent to OfficeManager.stop(), except any exceptions will be ignored. This is
typically used in finally blocks.
Example code:
OfficeManager manager = null;
try {
manager = LocalOfficeManager().make();
manager.start();
// process manager
} catch (Exception e) {
// error handling
} finally {
OfficeUtils.stopQuietly(manager);
}
manager - the manager to stop, may be null or already stopped.public static void deleteOrRenameFile(@NonNull File file, long interval, long timeout)
file - File or directory to delete, can be null.interval - The interval between each deletion attempt.timeout - The timeout after which we won't try again to execute the deletion.Copyright © 2016 - present; JODConverter.org. All rights reserved.