railo.runtime.util
Interface ResourceUtil

All Known Implementing Classes:
ResourceUtilImpl

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

FILE_SEPERATOR

static final char FILE_SEPERATOR
Field FILE_SEPERATOR


FILE_ANTI_SEPERATOR

static final char FILE_ANTI_SEPERATOR
Field FILE_ANTI_SEPERATOR


TYPE_DIR

static final short TYPE_DIR
Field TYPE_DIR

See Also:
Constant Field Values

TYPE_FILE

static final short TYPE_FILE
Field TYPE_FILE

See Also:
Constant Field Values

LEVEL_FILE

static final short LEVEL_FILE
Field LEVEL_FILE

See Also:
Constant Field Values

LEVEL_PARENT_FILE

static final short LEVEL_PARENT_FILE
Field LEVEL_PARENT_FILE

See Also:
Constant Field Values

LEVEL_GRAND_PARENT_FILE

static final short LEVEL_GRAND_PARENT_FILE
Field LEVEL_GRAND_PARENT_FILE

See Also:
Constant Field Values
Method Detail

toResourceExisting

Resource toResourceExisting(PageContext pc,
                            String path)
                            throws PageException
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

Parameters:
pc - Page Context to et actuell position in filesystem
path - relative or absolute path for file object
Returns:
file object from destination
Throws:
ExpressionException
PageException

toResourceExistingParent

Resource toResourceExistingParent(PageContext pc,
                                  String destination)
                                  throws PageException
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

Parameters:
pc - Page Context to et actuell position in filesystem
destination - relative or absolute path for file object
Returns:
file object from destination
Throws:
ExpressionException
PageException

toResourceNotExisting

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

Parameters:
pc - Page Context to et actuell position in filesystem
destination - relative or absolute path for file object
Returns:
file object from destination

createResource

Resource createResource(Resource res,
                        short level,
                        short type)
create a file if possible, return file if ok, otherwise return null

Parameters:
res - file to touch
level - touch also parent and grand parent
type - is file or directory
Returns:
file if exists, otherwise null

setAttribute

void setAttribute(Resource res,
                  String attributes)
                  throws IOException
sets a attribute to the resource

Parameters:
res -
attributes -
Throws:
IOException

getMymeType

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

Parameters:
res -
defaultValue -
Returns:
mime type of the file

getMymeType

String getMymeType(byte[] barr,
                   String defaultValue)
return the mime type of a byte array

Parameters:
barr -
defaultValue -
Returns:
mime type of the file

isChildOf

boolean isChildOf(Resource file,
                  Resource dir)
check if file is a child of given directory

Parameters:
file - file to search
dir - directory to search
Returns:
is inside or not

getPathToChild

String getPathToChild(Resource file,
                      Resource dir)
return diffrents of one file to a other if first is child of second otherwise return null

Parameters:
file - file to search
dir - directory to search

getExtension

String getExtension(Resource res)
get the Extension of a file resource

Parameters:
res -
Returns:
extension of file

getExtension

String getExtension(String strFile)
get the Extension of a file

Parameters:
strFile -
Returns:
extension of file

copyRecursive

void copyRecursive(Resource src,
                   Resource trg)
                   throws IOException
copy a file or directory recursive (with his content)

Parameters:
file - file or directory to delete
Throws:
IOException
FileNotFoundException

copyRecursive

void copyRecursive(Resource src,
                   Resource trg,
                   ResourceFilter filter)
                   throws IOException
copy a file or directory recursive (with his content)

Parameters:
src -
trg -
filter -
Throws:
IOException
FileNotFoundException

removeChildren

void removeChildren(Resource res)
                    throws IOException
Throws:
IOException

removeChildren

void removeChildren(Resource res,
                    ResourceNameFilter filter)
                    throws IOException
Throws:
IOException

removeChildren

void removeChildren(Resource res,
                    ResourceFilter filter)
                    throws IOException
Throws:
IOException

moveTo

void moveTo(Resource src,
            Resource dest)
            throws IOException
Throws:
IOException

isEmpty

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.

Parameters:
res -

isEmptyDirectory

boolean isEmptyDirectory(Resource res)

isEmptyFile

boolean isEmptyFile(Resource res)

translatePath

String translatePath(String path,
                     boolean slashAdBegin,
                     boolean slashAddEnd)

translatePathName

String[] translatePathName(String path)

merge

String merge(String parent,
             String child)

removeScheme

String removeScheme(String scheme,
                    String path)

checkCreateDirectoryOK

void checkCreateDirectoryOK(Resource resource,
                            boolean createParentWhenNotExists)
                            throws IOException
check if directory creation is ok with the rules for the Resource interface, to not change this rules.

Parameters:
resource -
createParentWhenNotExists -
Throws:
IOException

checkCreateFileOK

void checkCreateFileOK(Resource resource,
                       boolean createParentWhenNotExists)
                       throws IOException
check if file creating is ok with the rules for the Resource interface, to not change this rules.

Parameters:
resource -
createParentWhenNotExists -
Throws:
IOException

checkCopyToOK

void checkCopyToOK(Resource source,
                   Resource target)
                   throws IOException
check if copying a file is ok with the rules for the Resource interface, to not change this rules.

Parameters:
source -
target -
Throws:
IOException

checkMoveToOK

void checkMoveToOK(Resource source,
                   Resource target)
                   throws IOException
check if moveing a file is ok with the rules for the Resource interface, to not change this rules.

Parameters:
source -
target -
Throws:
IOException

checkGetInputStreamOK

void checkGetInputStreamOK(Resource resource)
                           throws IOException
check if getting a inputstream of the file is ok with the rules for the Resource interface, to not change this rules.

Parameters:
resource -
Throws:
IOException

checkGetOutputStreamOK

void checkGetOutputStreamOK(Resource resource)
                            throws IOException
check if getting a outputstream of the file is ok with the rules for the Resource interface, to not change this rules.

Parameters:
resource -
Throws:
IOException

checkRemoveOK

void checkRemoveOK(Resource resource)
                   throws IOException
check if removing the file is ok with the rules for the Resource interface, to not change this rules.

Parameters:
resource -
Throws:
IOException

toString

String toString(Resource r,
                String charset)
                throws IOException
Throws:
IOException


Copyright © 2012 Railo