public interface ResourceUtil
Modifier and Type | Field and Description |
---|---|
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 |
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.String |
contractPath(PageContext pc,
java.lang.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
|
java.lang.String |
getExtension(Resource res)
Deprecated.
use instead
getExtension(Resource res, String defaultValue); |
java.lang.String |
getExtension(Resource res,
java.lang.String defaultValue)
get the Extension of a file resource
|
java.lang.String |
getExtension(java.lang.String strFile)
Deprecated.
use instead
getExtension(String strFile, String defaultValue); |
java.lang.String |
getExtension(java.lang.String strFile,
java.lang.String defaultValue)
get the Extension of a file resource
|
java.lang.String |
getMimeType(byte[] barr,
java.lang.String defaultValue)
return the mime type of a byte array
|
java.lang.String |
getMimeType(Resource res,
java.lang.String defaultValue)
return the mime type of a file, does not check the extension of the file, it checks the header
|
java.lang.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) |
java.lang.String |
merge(java.lang.String parent,
java.lang.String child) |
void |
moveTo(Resource src,
Resource dest) |
void |
removeChildren(Resource res) |
void |
removeChildren(Resource res,
ResourceFilter filter) |
void |
removeChildren(Resource res,
ResourceNameFilter filter) |
java.lang.String |
removeScheme(java.lang.String scheme,
java.lang.String path) |
void |
setAttribute(Resource res,
java.lang.String attributes)
sets a attribute to the resource
|
Resource |
toResourceExisting(PageContext pc,
java.lang.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,
java.lang.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,
java.lang.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
|
java.lang.String |
toString(Resource r,
java.lang.String charset) |
java.lang.String |
translatePath(java.lang.String path,
boolean slashAdBegin,
boolean slashAddEnd) |
java.lang.String[] |
translatePathName(java.lang.String path) |
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
Resource toResourceExisting(PageContext pc, java.lang.String path) throws PageException
pc
- Page Context to et actuell position in filesystempath
- relative or absolute path for file objectExpressionException
PageException
Resource toResourceExistingParent(PageContext pc, java.lang.String destination) throws PageException
pc
- Page Context to et actuell position in filesystemdestination
- relative or absolute path for file objectExpressionException
PageException
Resource toResourceNotExisting(PageContext pc, java.lang.String destination)
pc
- Page Context to et actuell position in filesystemdestination
- relative or absolute path for file objectResource createResource(Resource res, short level, short type)
res
- file to touchlevel
- touch also parent and grand parenttype
- is file or directoryvoid setAttribute(Resource res, java.lang.String attributes) throws java.io.IOException
res
- attributes
- java.io.IOException
java.lang.String getMimeType(Resource res, java.lang.String defaultValue)
res
- defaultValue
- java.lang.String getMimeType(byte[] barr, java.lang.String defaultValue)
barr
- defaultValue
- boolean isChildOf(Resource file, Resource dir)
file
- file to searchdir
- directory to searchjava.lang.String getPathToChild(Resource file, Resource dir)
file
- file to searchdir
- directory to searchjava.lang.String getExtension(Resource res)
getExtension(Resource res, String defaultValue);
res
- java.lang.String getExtension(Resource res, java.lang.String defaultValue)
res
- java.lang.String getExtension(java.lang.String strFile)
getExtension(String strFile, String defaultValue);
strFile
- java.lang.String getExtension(java.lang.String strFile, java.lang.String defaultValue)
res
- void copyRecursive(Resource src, Resource trg) throws java.io.IOException
file
- file or directory to deletejava.io.IOException
java.io.FileNotFoundException
void copyRecursive(Resource src, Resource trg, ResourceFilter filter) throws java.io.IOException
src
- trg
- filter
- java.io.IOException
java.io.FileNotFoundException
void removeChildren(Resource res) throws java.io.IOException
java.io.IOException
void removeChildren(Resource res, ResourceNameFilter filter) throws java.io.IOException
java.io.IOException
void removeChildren(Resource res, ResourceFilter filter) throws java.io.IOException
java.io.IOException
void moveTo(Resource src, Resource dest) throws java.io.IOException
java.io.IOException
boolean isEmpty(Resource res)
res
- boolean isEmptyDirectory(Resource res)
boolean isEmptyFile(Resource res)
java.lang.String translatePath(java.lang.String path, boolean slashAdBegin, boolean slashAddEnd)
java.lang.String[] translatePathName(java.lang.String path)
java.lang.String merge(java.lang.String parent, java.lang.String child)
java.lang.String removeScheme(java.lang.String scheme, java.lang.String path)
void checkCreateDirectoryOK(Resource resource, boolean createParentWhenNotExists) throws java.io.IOException
resource
- createParentWhenNotExists
- java.io.IOException
void checkCreateFileOK(Resource resource, boolean createParentWhenNotExists) throws java.io.IOException
resource
- createParentWhenNotExists
- java.io.IOException
void checkCopyToOK(Resource source, Resource target) throws java.io.IOException
source
- target
- java.io.IOException
void checkMoveToOK(Resource source, Resource target) throws java.io.IOException
source
- target
- java.io.IOException
void checkGetInputStreamOK(Resource resource) throws java.io.IOException
resource
- java.io.IOException
void checkGetOutputStreamOK(Resource resource) throws java.io.IOException
resource
- java.io.IOException
void checkRemoveOK(Resource resource) throws java.io.IOException
resource
- java.io.IOException
java.lang.String toString(Resource r, java.lang.String charset) throws java.io.IOException
java.io.IOException
java.lang.String contractPath(PageContext pc, java.lang.String path)