org.apache.cassandra.io.util
Class FileUtils
java.lang.Object
org.apache.cassandra.io.util.FileUtils
public class FileUtils
- extends java.lang.Object
Method Summary |
static void |
createDirectory(java.lang.String directory)
|
static void |
createFile(java.lang.String directory)
|
static void |
createHardLink(java.io.File sourceFile,
java.io.File destinationFile)
Create a hard link for a given file. |
static void |
delete(java.io.File[] files)
|
static boolean |
delete(java.util.List<java.lang.String> files)
|
static boolean |
delete(java.lang.String file)
|
static void |
deleteDir(java.io.File dir)
Deletes all files and subdirectories under "dir". |
static void |
deleteWithConfirm(java.io.File file)
|
static long |
getUsedDiskSpaceForPath(java.lang.String path)
calculate the total space used by a file or directory |
static boolean |
isExists(java.lang.String filename)
|
static java.lang.String |
stringifyFileSize(double value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileUtils
public FileUtils()
deleteWithConfirm
public static void deleteWithConfirm(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
createDirectory
public static void createDirectory(java.lang.String directory)
throws java.io.IOException
- Throws:
java.io.IOException
createFile
public static void createFile(java.lang.String directory)
throws java.io.IOException
- Throws:
java.io.IOException
isExists
public static boolean isExists(java.lang.String filename)
throws java.io.IOException
- Throws:
java.io.IOException
delete
public static boolean delete(java.lang.String file)
delete
public static boolean delete(java.util.List<java.lang.String> files)
throws java.io.IOException
- Throws:
java.io.IOException
delete
public static void delete(java.io.File[] files)
throws java.io.IOException
- Throws:
java.io.IOException
stringifyFileSize
public static java.lang.String stringifyFileSize(double value)
getUsedDiskSpaceForPath
public static long getUsedDiskSpaceForPath(java.lang.String path)
- calculate the total space used by a file or directory
- Parameters:
path
- the path
- Returns:
- total space used.
deleteDir
public static void deleteDir(java.io.File dir)
throws java.io.IOException
- Deletes all files and subdirectories under "dir".
- Parameters:
dir
- Directory to be deleted
- Throws:
java.io.IOException
- if any part of the tree cannot be deleted
createHardLink
public static void createHardLink(java.io.File sourceFile,
java.io.File destinationFile)
throws java.io.IOException
- Create a hard link for a given file.
- Parameters:
sourceFile
- The name of the source file.destinationFile
- The name of the destination file.
- Throws:
java.io.IOException
- if an error has occurred while creating the link.
Copyright © 2010 The Apache Software Foundation