|
ColdBox Platform Version 2.6.3 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.frameworkSupertype
coldbox.system.plugin
coldbox.system.plugins.Utilities
public class Utilities
This is a Utilities CFC
Constructor Summary | |
---|---|
init(any controller)
|
Method Summary | |
---|---|
boolean |
FileCanRead(String Filename)
Check wether you can read a file |
boolean |
FileCanWrite(String Filename)
Check wether you can write to a file |
string |
FileLastModified(string filename)
Get the last modified date of a file |
string |
FileSize(string filename, [string sizeFormat='bytes'])
Get the filesize of a file. |
boolean |
IsEmail(any str, [string tlds=''])
author Jeff Guillaume (jeff@kazoomis.com): Tests passed value to see if it is a valid e-mail address (supports subdomain nesting and new top-level domains) |
boolean |
IsURL(any str)
author Nathan Dintenfass (nathan@changemedia.com): A quick way to test if a string is a URL |
Any |
_deserialize(string BinaryString)
Deserialize a byte array |
Any |
_deserializeFromFile(string fileSource)
Deserialize a byte array from a file |
string |
_serialize(any ComplexObject)
Serialize complex objects that implement serializable. Returns a binary string. |
void |
_serializeToFile(any ComplexObject, string fileDestination)
Serialize complex objects that implement serializable, into a file. |
void |
appendFile(any FileToSave, any FileContents, [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
Facade to append to a file's content |
string |
checkCharSet(string charset)
Check a charset with valid CF char sets, if invalid, it returns the framework's default character set |
array |
createArray(string str)
Create an Array from conventions [ elem, elem ] |
void |
createFile(String filename)
Create a new empty fileusing java.io.File. |
struct |
createStruct(string str)
Create a Structure from conventions { key: value, key2= value } |
string |
getAbsolutePath(string path)
Turn any system path, either relative or absolute, into a fully qualified one |
string |
getFileMimeType(string extension)
Get's the file mime type for a given file extension |
string |
getIPAddress()
Get the ip address of the executing hostname machine. |
string |
getInetHost()
Get the hostname of the executing machine. |
string |
getJVMTotalMemory()
Get the JVM's total memory. |
string |
getJVMfreeMemory()
Get the JVM's free memory. |
string |
getJavaRuntime()
Get the java runtime version |
string |
getJavaVersion()
Get the java version. |
string |
getOSFileSeparator()
Get the operating system's file separator character |
string |
getOSName()
Get the operating system's name |
string |
getOSPathSeparator()
Get the operating system's path separator character. |
boolean |
isCFUUID(string inStr)
Checks if a passed string is a valid UUID. |
boolean |
isDirectory(String Filename)
Check wether the filename argument is a directory or not |
boolean |
isFile(String Filename)
Checks whether the filename argument is a file or not. |
boolean |
isSSL()
Tells you if you are in SSL mode or not. |
any |
marshallData(string type, any data)
Marshall data according to type |
string |
parseISO8601(string datetime)
Parse a UTC or iso8601 date to a normal CF datetime object |
string |
parseRFC822(string datetime)
Parse RFC822 dates, returns empty string if not a valid date. |
any |
placeHolderReplacer(any str, any settings)
PlaceHolder Replacer for strings containing ${} patterns |
Any |
readFile(String FileToRead, [boolean ReadInBinaryFlag='false'], [string CharSet=''], [boolean CheckCharSetFlag='false'])
Facade to Read a file's content |
boolean |
removeFile(string filename)
Remove a file using java.io.File |
string |
ripExtension(string filename)
Rip the extension of a filename. |
void |
saveFile(any FileToSave, any FileContents, [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
Facade to save a file's content |
void |
sendFile([any file=''], [string name=''], [string mimeType=''], [string disposition='attachment'], [boolean abortAtEnd='false'], [string extension=''])
Send a file to the browser |
void |
sleeper(numeric milliseconds)
Make the main thread of execution sleep for X amount of seconds. |
any |
uploadFile(string FileField, string Destination, [string NameConflict='makeunique'], [string Accept=''], [string Attributes='Normal'], [string Mode='755'])
Facade to upload to a file, returns the cffile variable. |
Methods inherited from class coldbox.system.plugin |
---|
getPluginDescription, getPluginName, getPluginVersion, getpluginPath, setPluginDescription, setPluginName, setPluginVersion
|
Methods inherited from class WEB-INF.cftags.component |
---|
|
Constructor Detail |
---|
public init(any controller)
Method Detail |
---|
public boolean FileCanRead(String Filename)
Filename
- The absolute path of the file to check.public boolean FileCanWrite(String Filename)
Filename
- The absolute path of the file to check.public string FileLastModified(string filename)
filename
public string FileSize(string filename, [string sizeFormat='bytes'])
filename
sizeFormat
- Available formats: [bytes][kbytes][mbytes][gbytes]public boolean IsEmail(any str, [string tlds=''])
str
tlds
- Additional top level domains to add to the evaluation. Use a | to separate thempublic boolean IsURL(any str)
str
public Any _deserialize(string BinaryString)
BinaryString
- The byte array string to deserializepublic Any _deserializeFromFile(string fileSource)
fileSource
- The absolute path to the source file to deserializepublic string _serialize(any ComplexObject)
ComplexObject
- Any coldfusion primative data type and if cf8 componetns.public void _serializeToFile(any ComplexObject, string fileDestination)
ComplexObject
- Any coldfusion primative data type and if cf8 componetns.fileDestination
- The absolute path to the destination file to write topublic void appendFile(any FileToSave, any FileContents, [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
FileToSave
- The absolute path to the file.FileContents
- The file contentsCharSet
- CF File CharSet Encoding to use.CheckCharSetFlag
- Check the charset.public string checkCharSet(string charset)
charset
- Charset to checkpublic array createArray(string str)
str
- The convention string to create an array from. This is basic JSON syntaxpublic void createFile(String filename)
filename
- The absolute path of the file to create.public struct createStruct(string str)
str
- The convention string to create a struct from. This is basic JSON syntaxpublic string getAbsolutePath(string path)
path
- Abstract pathnamepublic string getFileMimeType(string extension)
extension
- e.g. jpg or gifpublic string getIPAddress()
public string getInetHost()
public string getJVMTotalMemory()
public string getJVMfreeMemory()
public string getJavaRuntime()
public string getJavaVersion()
public string getOSFileSeparator()
public string getOSName()
public string getOSPathSeparator()
public boolean isCFUUID(string inStr)
inStr
public boolean isDirectory(String Filename)
Filename
- The absolute path of the file to check.public boolean isFile(String Filename)
Filename
- The absolute path of the file to check.public boolean isSSL()
public any marshallData(string type, any data)
type
- The type to marshal to. Valid values are JSON, WDDX, PLAINdata
- The data to marshalpublic string parseISO8601(string datetime)
datetime
- The datetime string to convertpublic string parseRFC822(string datetime)
datetime
- The datetime string to convertpublic any placeHolderReplacer(any str, any settings)
str
- The string variable to look for replacementssettings
- The structure of settings to use in replacingpublic Any readFile(String FileToRead, [boolean ReadInBinaryFlag='false'], [string CharSet=''], [boolean CheckCharSetFlag='false'])
FileToRead
- The absolute path to the file.ReadInBinaryFlag
- Read in binary flag.CharSet
- CF File CharSet Encoding to use.CheckCharSetFlag
- Check the charset.public boolean removeFile(string filename)
filename
- The absolute path to the file.public string ripExtension(string filename)
filename
public void saveFile(any FileToSave, any FileContents, [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
FileToSave
- The absolute path to the file.FileContents
- The file contentsCharSet
- CF File CharSet Encoding to use.CheckCharSetFlag
- Check the charset.public void sendFile([any file=''], [string name=''], [string mimeType=''], [string disposition='attachment'], [boolean abortAtEnd='false'], [string extension=''])
file
- The absolute path to the file or a binary filename
- The name to send the file to the browser. If not sent in, it will use the name of the file or a UUID for a binary filemimeType
- A valid mime type to use. If not sent in, we will try to use a default one according to file extensiondisposition
- The browser content disposition (attachment/inline)abortAtEnd
- Do an abort after content sendingextension
- Only used if file is binary. e.g. jpg or gifpublic void sleeper(numeric milliseconds)
milliseconds
- Milliseconds to sleeppublic any uploadFile(string FileField, string Destination, [string NameConflict='makeunique'], [string Accept=''], [string Attributes='Normal'], [string Mode='755'])
FileField
- The name of the form field used to select the fileDestination
- The absolute path to the destination.NameConflict
- Action to take if filename is the same as that of a file in the directory.Accept
- Limits the MIME types to accept. Comma-delimited list.Attributes
- Comma-delimitted list of window file attributesMode
- The mode of the file for Unix systems, the default is 755
|
ColdBox Platform Version 2.6.3 | ||||
FRAMES |