|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.atunes.kernel.utils.FileNameUtils
public class FileNameUtils
Utility methods for replacing illegal characters in filenames
The getValidFileName method is designed to handle filenames only, so do not pass the whole path. For folders, use the getValidFolderName function, but do not pass the filename with the folder name. Folder name can include full path, except as said the filename. We are as permissive as possible, which means this can cause interoperability problems (songs ripped on a Unix-like system then played on a Windows OS for example). Further, we do not check what file system is used, which can cause problems when writing to a FAT/FAT32 partition for example. We do not yet check the filename length (255 characters max for all OS).
The characters in the list are probably incomplete and users might want other substitutions so please change and complete accordingly.
Constructor Summary | |
---|---|
FileNameUtils()
|
Method Summary | |
---|---|
static java.lang.String |
getValidFileName(java.lang.String fileName)
Checks for valid filenames. |
static java.lang.String |
getValidFileName(java.lang.String fileNameStr,
boolean isMp3Device)
Checks for valid filenames. |
static java.lang.String |
getValidFolderName(java.lang.String folderName)
Checks for valid folder names. |
static java.lang.String |
getValidFolderName(java.lang.String folderNameStr,
boolean isMp3Device)
Checks for valid folder names. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileNameUtils()
Method Detail |
---|
public static java.lang.String getValidFileName(java.lang.String fileName)
fileName
- The filename to be checked. Please make sure to check for
escape sequences (\, $) and add a \ before them before calling
this method.
public static java.lang.String getValidFileName(java.lang.String fileNameStr, boolean isMp3Device)
fileNameStr
- The filename to be checked. Please make sure to check for
escape sequences (\, $) and add a \ before them before calling
this method.isMp3Device
- if valid file name for Mp3 device (->FAT/FAT32)
public static java.lang.String getValidFolderName(java.lang.String folderName)
folderName
- The folder name to be checked.
public static java.lang.String getValidFolderName(java.lang.String folderNameStr, boolean isMp3Device)
folderNameStr
- The folder name to be checked.isMp3Device
- if valid folder name for Mp3 device (->FAT/FAT32)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |