|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.axelwernicke.mypod.util.FileUtils
Class that provides some helpers related to file operations.
Field Summary | |
static java.util.regex.Pattern |
mp3FilePattern
Pattern to recognize mp3 files |
Method Summary | |
static long |
bufferedCopy(java.io.File source,
java.io.File destination,
int streamBufferSize,
int localBufferSize)
Copies file using old io with custom buffered streams |
static long |
copy(java.io.File source,
java.io.File destination)
Copies file using nio transfer method. |
static boolean |
delete(java.io.File file)
Deletes a file. |
static int |
deleteEmptyDirectories(java.util.Vector dirs)
Deletes empty directories recursively. |
static java.util.Vector |
getAllDirectories(java.io.File dir)
Gets all subdirectories recursively. |
static java.util.Vector |
getAllFiles(java.io.File dir,
java.util.regex.Pattern filter)
Gets all files below the given directory. |
FileUtils |
getInstance()
This is a singleton class, so use getInstance to get in instance :) |
static long |
getSpaceLeft(java.lang.String path)
Determines the space left on a disc The space is determined by executing a native command ( e.g. dir for windows, df for linux ) This is platform dependend, but ther's no solution provided by java :( |
static long |
getTotalFilesize(java.io.File dir,
java.util.regex.Pattern pattern)
Gets the total filesize recursively |
static boolean |
isWritable(java.io.File file,
int maxWait)
Checks if a file is writable. |
static int |
makeFileAvailable(java.io.File file)
Checks if a file is accessable. |
static int |
makeFileRWAvailable(java.io.File file)
Checks if a file is accessable and writable. |
static boolean |
move(java.io.File source,
java.io.File destination)
Moves a file. |
static java.lang.String |
validateDirectoryName(java.lang.String _filename)
Validates a directory name by replacing invalid characters. |
static java.lang.String |
validateFileName(java.lang.String _filename)
Validates a filename by replacing invalid characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.util.regex.Pattern mp3FilePattern
Method Detail |
public FileUtils getInstance()
public static boolean isWritable(java.io.File file, int maxWait)
file
- maxWait
-
public static long copy(java.io.File source, java.io.File destination)
source
- filedestination
- file
public static long bufferedCopy(java.io.File source, java.io.File destination, int streamBufferSize, int localBufferSize)
streamBufferSize
- in byteslocalBufferSize
- in bytessource
- filedestination
- file
public static boolean move(java.io.File source, java.io.File destination)
source
- filedestination
- file
public static boolean delete(java.io.File file)
file
- to be deleted
public static java.lang.String validateFileName(java.lang.String _filename)
_filename
- to validate
public static java.lang.String validateDirectoryName(java.lang.String _filename)
_filename
- to validate
public static java.util.Vector getAllDirectories(java.io.File dir)
dir
- base directory
public static java.util.Vector getAllFiles(java.io.File dir, java.util.regex.Pattern filter)
filter
- file filter that determines the files to finddir
- base directory
public static long getTotalFilesize(java.io.File dir, java.util.regex.Pattern pattern)
dir
- to get file size forpattern
- to select files
public static long getSpaceLeft(java.lang.String path)
path
- path to the disc to get free space for
public static int deleteEmptyDirectories(java.util.Vector dirs)
public static int makeFileAvailable(java.io.File file)
file
- to check
public static int makeFileRWAvailable(java.io.File file)
file
- to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |