public class OFileUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
GIGABYTE |
static int |
KILOBYTE |
static int |
MEGABYTE |
static long |
TERABYTE |
Constructor and Description |
---|
OFileUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
atomicMoveWithFallback(Path source,
Path target,
Object requester)
Tries to move a file from the source to the target atomically.
|
static void |
checkValidName(String iFileName) |
static void |
copyDirectory(File source,
File destination) |
static void |
copyFile(File source,
File destination) |
static void |
createDirectoryTree(String iFileName) |
static boolean |
delete(File file) |
static void |
deleteFolderIfEmpty(File dir) |
static void |
deleteRecursively(File rootFile) |
static void |
deleteRecursively(File rootFile,
boolean onlyDirs) |
static String |
getDirectory(String iPath) |
static String |
getPath(String iPath) |
static long |
getSizeAsNumber(Object iSize) |
static String |
getSizeAsString(long iSize) |
static void |
prepareForFileCreationOrReplacement(Path path,
Object requester,
String operation)
Prepares the path for a file creation or replacement.
|
static boolean |
renameFile(File from,
File to) |
static Number |
string2number(String iText) |
public static final int KILOBYTE
public static final int MEGABYTE
public static final int GIGABYTE
public static final long TERABYTE
public static long getSizeAsNumber(Object iSize)
public static String getSizeAsString(long iSize)
public static void createDirectoryTree(String iFileName)
public static void checkValidName(String iFileName) throws IOException
IOException
public static void deleteRecursively(File rootFile)
public static void deleteRecursively(File rootFile, boolean onlyDirs)
public static void deleteFolderIfEmpty(File dir)
public static final void copyFile(File source, File destination) throws IOException
IOException
public static final void copyDirectory(File source, File destination) throws IOException
IOException
public static boolean renameFile(File from, File to) throws IOException
IOException
public static boolean delete(File file) throws IOException
IOException
public static void prepareForFileCreationOrReplacement(Path path, Object requester, String operation) throws IOException
path
- the file path.requester
- the requester of an operation being performed to produce user-friendly log
messages.operation
- the description of an operation being performed to produce user-friendly log
messages. Use descriptions like "exporting", "backing up", etc.IOException
public static void atomicMoveWithFallback(Path source, Path target, Object requester) throws IOException
source
- the source to move the file from.target
- the target to move the file to.requester
- the requester of the move being performed to produce user-friendly log
messages.IOException
Files.move(Path, Path, CopyOption...)
,
StandardCopyOption.ATOMIC_MOVE
Copyright © 2009–2020 OrientDB. All rights reserved.