|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.util.FileUtil
public final class FileUtil
File utilities.
Field Summary | |
---|---|
static int |
BUFFER_SIZE
|
Method Summary | |
---|---|
static String |
compactPath(String path)
Compacts a path by stacking it and reducing .., and uses OS specific file separators (eg File.separator ). |
static String |
compactPath(String path,
char separator)
Compacts a path by stacking it and reducing .., and uses the given separator. |
static void |
copyFile(File from,
File to)
|
static boolean |
createNewFile(File file)
Creates a new file. |
static File |
createTempFile(String prefix,
String suffix)
Deprecated. |
static File |
createTempFile(String prefix,
String suffix,
File parentDir)
|
static boolean |
deleteFile(File file)
|
static File |
getUserDir()
|
static boolean |
hasLeadingSeparator(String name)
Does the name start with a leading separator |
static boolean |
isAbsolute(File file)
Is the given file an absolute file. |
static boolean |
isWindows()
Returns true, if the OS is windows |
static String |
normalizePath(String path)
Normalizes the path to cater for Windows and other platforms |
static String |
onlyPath(String name)
Returns only the leading path (returns null if no path) |
static void |
removeDir(File d)
|
static boolean |
renameFile(File from,
File to,
boolean copyAndDeleteOnRenameFail)
Renames a file. |
static boolean |
renameFileUsingCopy(File from,
File to)
Rename file using copy and delete strategy. |
static void |
shutdown()
Deprecated. |
static String |
stripExt(String name)
|
static String |
stripFirstLeadingSeparator(String name)
Strip first leading separator |
static String |
stripLeadingSeparator(String name)
Strip any leading separators |
static String |
stripPath(String name)
Strips any leading paths |
static String |
stripTrailingSeparator(String name)
Strip any trailing separators |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFFER_SIZE
Method Detail |
---|
public static File getUserDir()
public static String normalizePath(String path)
public static boolean isWindows()
@Deprecated public static File createTempFile(String prefix, String suffix) throws IOException
IOException
public static File createTempFile(String prefix, String suffix, File parentDir) throws IOException
IOException
public static String stripLeadingSeparator(String name)
public static boolean hasLeadingSeparator(String name)
public static String stripFirstLeadingSeparator(String name)
public static String stripTrailingSeparator(String name)
public static String stripPath(String name)
public static String stripExt(String name)
public static String onlyPath(String name)
public static String compactPath(String path)
File.separator
).
public static String compactPath(String path, char separator)
@Deprecated public static void shutdown()
public static void removeDir(File d)
public static boolean renameFile(File from, File to, boolean copyAndDeleteOnRenameFail) throws IOException
from
- the from fileto
- the to filecopyAndDeleteOnRenameFail
- whether to fallback and do copy and delete, if renameTo fails
IOException
- is thrown if error renaming filepublic static boolean renameFileUsingCopy(File from, File to) throws IOException
from
- the file to be renamedto
- the new target file
IOException
- If an I/O error occurs during copy or delete operations.public static void copyFile(File from, File to) throws IOException
IOException
public static boolean deleteFile(File file)
public static boolean isAbsolute(File file)
file
- the file
public static boolean createNewFile(File file) throws IOException
file
- the file
IOException
- is thrown if error creating the new file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |