|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ResourceUtil
Field Summary | |
---|---|
static char |
FILE_ANTI_SEPERATOR
Field FILE_ANTI_SEPERATOR |
static char |
FILE_SEPERATOR
Field FILE_SEPERATOR |
static short |
LEVEL_FILE
Field LEVEL_FILE |
static short |
LEVEL_GRAND_PARENT_FILE
Field LEVEL_GRAND_PARENT_FILE |
static short |
LEVEL_PARENT_FILE
Field LEVEL_PARENT_FILE |
static short |
TYPE_DIR
Field TYPE_DIR |
static short |
TYPE_FILE
Field TYPE_FILE |
Method Summary | |
---|---|
void |
checkCopyToOK(Resource source,
Resource target)
check if copying a file is ok with the rules for the Resource interface, to not change this rules. |
void |
checkCreateDirectoryOK(Resource resource,
boolean createParentWhenNotExists)
check if directory creation is ok with the rules for the Resource interface, to not change this rules. |
void |
checkCreateFileOK(Resource resource,
boolean createParentWhenNotExists)
check if file creating is ok with the rules for the Resource interface, to not change this rules. |
void |
checkGetInputStreamOK(Resource resource)
check if getting a inputstream of the file is ok with the rules for the Resource interface, to not change this rules. |
void |
checkGetOutputStreamOK(Resource resource)
check if getting a outputstream of the file is ok with the rules for the Resource interface, to not change this rules. |
void |
checkMoveToOK(Resource source,
Resource target)
check if moveing a file is ok with the rules for the Resource interface, to not change this rules. |
void |
checkRemoveOK(Resource resource)
check if removing the file is ok with the rules for the Resource interface, to not change this rules. |
void |
copyRecursive(Resource src,
Resource trg)
copy a file or directory recursive (with his content) |
void |
copyRecursive(Resource src,
Resource trg,
ResourceFilter filter)
copy a file or directory recursive (with his content) |
Resource |
createResource(Resource res,
short level,
short type)
create a file if possible, return file if ok, otherwise return null |
String |
getExtension(Resource res)
get the Extension of a file resource |
String |
getExtension(String strFile)
get the Extension of a file |
String |
getMymeType(byte[] barr,
String defaultValue)
return the mime type of a byte array |
String |
getMymeType(Resource res,
String defaultValue)
return the mime type of a file, does not check the extension of the file, it checks the header |
String |
getPathToChild(Resource file,
Resource dir)
return diffrents of one file to a other if first is child of second otherwise return null |
boolean |
isChildOf(Resource file,
Resource dir)
check if file is a child of given directory |
boolean |
isEmpty(Resource res)
return if Resource is empty, means is directory and has no children or a empty file, if not exists return false. |
boolean |
isEmptyDirectory(Resource res)
|
boolean |
isEmptyFile(Resource res)
|
String |
merge(String parent,
String child)
|
void |
moveTo(Resource src,
Resource dest)
|
void |
removeChildren(Resource res)
|
void |
removeChildren(Resource res,
ResourceFilter filter)
|
void |
removeChildren(Resource res,
ResourceNameFilter filter)
|
String |
removeScheme(String scheme,
String path)
|
void |
setAttribute(Resource res,
String attributes)
sets a attribute to the resource |
Resource |
toResourceExisting(PageContext pc,
String path)
cast a String (argument destination) to a File Object, if destination is not a absolute, file object will be relative to current position (get from PageContext) file must exist otherwise throw exception |
Resource |
toResourceExistingParent(PageContext pc,
String destination)
cast a String (argument destination) to a File Object, if destination is not a absolute, file object will be relative to current position (get from PageContext) at least parent must exist |
Resource |
toResourceNotExisting(PageContext pc,
String destination)
cast a String (argument destination) to a File Object, if destination is not a absolute, file object will be relative to current position (get from PageContext) existing file is prefered but dont must exist |
String |
toString(Resource r,
String charset)
|
String |
translatePath(String path,
boolean slashAdBegin,
boolean slashAddEnd)
|
String[] |
translatePathName(String path)
|
Field Detail |
---|
static final char FILE_SEPERATOR
FILE_SEPERATOR
static final char FILE_ANTI_SEPERATOR
FILE_ANTI_SEPERATOR
static final short TYPE_DIR
TYPE_DIR
static final short TYPE_FILE
TYPE_FILE
static final short LEVEL_FILE
LEVEL_FILE
static final short LEVEL_PARENT_FILE
LEVEL_PARENT_FILE
static final short LEVEL_GRAND_PARENT_FILE
LEVEL_GRAND_PARENT_FILE
Method Detail |
---|
Resource toResourceExisting(PageContext pc, String path) throws PageException
pc
- Page Context to et actuell position in filesystempath
- relative or absolute path for file object
ExpressionException
PageException
Resource toResourceExistingParent(PageContext pc, String destination) throws PageException
pc
- Page Context to et actuell position in filesystemdestination
- relative or absolute path for file object
ExpressionException
PageException
Resource toResourceNotExisting(PageContext pc, String destination)
pc
- Page Context to et actuell position in filesystemdestination
- relative or absolute path for file object
Resource createResource(Resource res, short level, short type)
res
- file to touchlevel
- touch also parent and grand parenttype
- is file or directory
void setAttribute(Resource res, String attributes) throws IOException
res
- attributes
-
IOException
String getMymeType(Resource res, String defaultValue)
res
- defaultValue
-
String getMymeType(byte[] barr, String defaultValue)
barr
- defaultValue
-
boolean isChildOf(Resource file, Resource dir)
file
- file to searchdir
- directory to search
String getPathToChild(Resource file, Resource dir)
file
- file to searchdir
- directory to searchString getExtension(Resource res)
res
-
String getExtension(String strFile)
strFile
-
void copyRecursive(Resource src, Resource trg) throws IOException
file
- file or directory to delete
IOException
FileNotFoundException
void copyRecursive(Resource src, Resource trg, ResourceFilter filter) throws IOException
src
- trg
- filter
-
IOException
FileNotFoundException
void removeChildren(Resource res) throws IOException
IOException
void removeChildren(Resource res, ResourceNameFilter filter) throws IOException
IOException
void removeChildren(Resource res, ResourceFilter filter) throws IOException
IOException
void moveTo(Resource src, Resource dest) throws IOException
IOException
boolean isEmpty(Resource res)
res
- boolean isEmptyDirectory(Resource res)
boolean isEmptyFile(Resource res)
String translatePath(String path, boolean slashAdBegin, boolean slashAddEnd)
String[] translatePathName(String path)
String merge(String parent, String child)
String removeScheme(String scheme, String path)
void checkCreateDirectoryOK(Resource resource, boolean createParentWhenNotExists) throws IOException
resource
- createParentWhenNotExists
-
IOException
void checkCreateFileOK(Resource resource, boolean createParentWhenNotExists) throws IOException
resource
- createParentWhenNotExists
-
IOException
void checkCopyToOK(Resource source, Resource target) throws IOException
source
- target
-
IOException
void checkMoveToOK(Resource source, Resource target) throws IOException
source
- target
-
IOException
void checkGetInputStreamOK(Resource resource) throws IOException
resource
-
IOException
void checkGetOutputStreamOK(Resource resource) throws IOException
resource
-
IOException
void checkRemoveOK(Resource resource) throws IOException
resource
-
IOException
String toString(Resource r, String charset) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |