|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.fckeditor.tool.UtilsFile
public class UtilsFile
Some static helper methods in conjunction with files.
Field Summary | |
---|---|
protected static java.util.regex.Pattern |
ILLEGAL_CURRENT_FOLDER_PATTERN
|
Constructor Summary | |
---|---|
UtilsFile()
|
Method Summary | |
---|---|
static void |
checkDirAndCreate(java.io.File dir)
Checks for a dir and creates it if it does not exist. |
static java.lang.String |
constructServerSidePath(javax.servlet.http.HttpServletRequest request,
ResourceTypeHandler resourceType)
Compose server-side response path. |
static java.lang.String |
forceSingleExtension(java.lang.String filename)
Replaces all dots except the last one with underscores in a filename. |
static boolean |
isImage(java.io.InputStream in)
Checks if the underlying file of the InputStream is an image. |
static boolean |
isSingleExtension(java.lang.String filename)
Checks if a filename contains more than one dot. |
static boolean |
isValidPath(java.lang.String path)
Checks if a path corresponds to the rules defined here. |
static java.lang.String |
sanitizeFileName(java.lang.String fileName)
Do a cleanup of the file name to avoid possible problems. The forceSingleExtension |
static java.lang.String |
sanitizeFolderName(java.lang.String folderName)
Do a cleanup of the folder name to avoid possible problems. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.util.regex.Pattern ILLEGAL_CURRENT_FOLDER_PATTERN
Constructor Detail |
---|
public UtilsFile()
Method Detail |
---|
public static java.lang.String sanitizeFileName(java.lang.String fileName)
forceSingleExtension property will be respected!
- Parameters:
fileName
-
- Returns:
- folder name where \ / | : ? * " < > 'control chars' replaced by '_'
public static java.lang.String sanitizeFolderName(java.lang.String folderName)
folderName
-
public static boolean isImage(java.io.InputStream in)
in
- An input stream
true
if the underlying file is an image else
false
.public static boolean isValidPath(java.lang.String path)
path
-
true
if path corresponds to rules or
false
.public static java.lang.String forceSingleExtension(java.lang.String filename)
filename
-
public static boolean isSingleExtension(java.lang.String filename)
filename
-
true
if filename contains severals dots else
false
public static void checkDirAndCreate(java.io.File dir)
dir
- Directory to check/create.public static java.lang.String constructServerSidePath(javax.servlet.http.HttpServletRequest request, ResourceTypeHandler resourceType)
request
- resourceType
-
resourceType
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |