|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrailo.commons.io.res.util.ResourceUtilImpl
public class ResourceUtilImpl
Field Summary |
---|
Fields inherited from interface railo.runtime.util.ResourceUtil |
---|
FILE_ANTI_SEPERATOR, FILE_SEPERATOR, LEVEL_FILE, LEVEL_GRAND_PARENT_FILE, LEVEL_PARENT_FILE, TYPE_DIR, 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. |
String |
contractPath(PageContext pc,
String path)
|
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(Resource res,
String defaultValue)
get the Extension of a file resource |
String |
getExtension(String strFile)
get the Extension of a file |
String |
getExtension(String strFile,
String defaultValue)
get the Extension of a file resource |
static ResourceUtilImpl |
getInstance()
|
String |
getMimeType(byte[] barr,
String defaultValue)
return the mime type of a byte array |
String |
getMimeType(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 exist 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)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ResourceUtilImpl getInstance()
public void checkCopyToOK(Resource source, Resource target) throws IOException
ResourceUtil
checkCopyToOK
in interface ResourceUtil
IOException
public void checkCreateDirectoryOK(Resource resource, boolean createParentWhenNotExists) throws IOException
ResourceUtil
checkCreateDirectoryOK
in interface ResourceUtil
IOException
public void checkCreateFileOK(Resource resource, boolean createParentWhenNotExists) throws IOException
ResourceUtil
checkCreateFileOK
in interface ResourceUtil
IOException
public void checkGetInputStreamOK(Resource resource) throws IOException
ResourceUtil
checkGetInputStreamOK
in interface ResourceUtil
IOException
public void checkGetOutputStreamOK(Resource resource) throws IOException
ResourceUtil
checkGetOutputStreamOK
in interface ResourceUtil
IOException
public void checkMoveToOK(Resource source, Resource target) throws IOException
ResourceUtil
checkMoveToOK
in interface ResourceUtil
IOException
public void checkRemoveOK(Resource resource) throws IOException
ResourceUtil
checkRemoveOK
in interface ResourceUtil
IOException
public void copyRecursive(Resource src, Resource trg) throws IOException
ResourceUtil
copyRecursive
in interface ResourceUtil
IOException
FileNotFoundException
public void copyRecursive(Resource src, Resource trg, ResourceFilter filter) throws IOException
ResourceUtil
copyRecursive
in interface ResourceUtil
IOException
FileNotFoundException
public Resource createResource(Resource res, short level, short type)
ResourceUtil
createResource
in interface ResourceUtil
res
- file to touchlevel
- touch also parent and grand parenttype
- is file or directory
public String getExtension(Resource res)
ResourceUtil
getExtension
in interface ResourceUtil
public String getExtension(Resource res, String defaultValue)
ResourceUtil
getExtension
in interface ResourceUtil
public String getExtension(String strFile)
ResourceUtil
getExtension
in interface ResourceUtil
public String getExtension(String strFile, String defaultValue)
ResourceUtil
getExtension
in interface ResourceUtil
public String getMimeType(Resource res, String defaultValue)
ResourceUtil
getMimeType
in interface ResourceUtil
public String getMimeType(byte[] barr, String defaultValue)
ResourceUtil
getMimeType
in interface ResourceUtil
public String getPathToChild(Resource file, Resource dir)
ResourceUtil
getPathToChild
in interface ResourceUtil
file
- file to searchdir
- directory to searchpublic boolean isChildOf(Resource file, Resource dir)
ResourceUtil
isChildOf
in interface ResourceUtil
file
- file to searchdir
- directory to search
public boolean isEmpty(Resource res)
ResourceUtil
isEmpty
in interface ResourceUtil
public boolean isEmptyDirectory(Resource res)
isEmptyDirectory
in interface ResourceUtil
public boolean isEmptyFile(Resource res)
isEmptyFile
in interface ResourceUtil
public String merge(String parent, String child)
merge
in interface ResourceUtil
public void moveTo(Resource src, Resource dest) throws IOException
moveTo
in interface ResourceUtil
IOException
public void removeChildren(Resource res) throws IOException
removeChildren
in interface ResourceUtil
IOException
public void removeChildren(Resource res, ResourceNameFilter filter) throws IOException
removeChildren
in interface ResourceUtil
IOException
public void removeChildren(Resource res, ResourceFilter filter) throws IOException
removeChildren
in interface ResourceUtil
IOException
public String removeScheme(String scheme, String path)
removeScheme
in interface ResourceUtil
public void setAttribute(Resource res, String attributes) throws IOException
ResourceUtil
setAttribute
in interface ResourceUtil
IOException
public Resource toResourceExisting(PageContext pc, String path) throws PageException
ResourceUtil
toResourceExisting
in interface ResourceUtil
pc
- Page Context to et actuell position in filesystempath
- relative or absolute path for file object
PageException
public Resource toResourceExistingParent(PageContext pc, String destination) throws PageException
ResourceUtil
toResourceExistingParent
in interface ResourceUtil
pc
- Page Context to et actuell position in filesystemdestination
- relative or absolute path for file object
PageException
public Resource toResourceNotExisting(PageContext pc, String destination)
ResourceUtil
toResourceNotExisting
in interface ResourceUtil
pc
- Page Context to et actuell position in filesystemdestination
- relative or absolute path for file object
public String translatePath(String path, boolean slashAdBegin, boolean slashAddEnd)
translatePath
in interface ResourceUtil
public String[] translatePathName(String path)
translatePathName
in interface ResourceUtil
public String toString(Resource r, String charset) throws IOException
toString
in interface ResourceUtil
IOException
public String contractPath(PageContext pc, String path)
contractPath
in interface ResourceUtil
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |