railo.commons.io
Class SystemUtil

java.lang.Object
  extended by railo.commons.io.SystemUtil

public final class SystemUtil
extends Object


Nested Class Summary
static class SystemUtil.TemplateLine
           
 
Field Summary
static int ARCH_32
           
static int ARCH_64
           
static int ARCH_UNKNOW
           
static char CHAR_DOLLAR
           
static char CHAR_EURO
           
static char CHAR_POUND
           
static int ERR
           
static int jreArch
           
static int MEMORY_TYPE_ALL
           
static int MEMORY_TYPE_HEAP
           
static int MEMORY_TYPE_NON_HEAP
           
static int osArch
           
static int OUT
           
 
Constructor Summary
SystemUtil()
           
 
Method Summary
static String addPlaceHolder(Resource file, Config config, String defaultValue)
           
static String addPlaceHolder(Resource file, String defaultValue)
           
static int getAddressSize()
           
static long getAvailableMemory()
           
static String getCharset()
           
static Resource getClassLoadeDirectory()
           
static Resource[] getClassPathes()
           
static double getCpuUsage(long time)
           
static SystemUtil.TemplateLine getCurrentContext()
           
static long getFreeBytes()
           
static int getFreePermGenSpacePromille()
           
static long getFreePermGenSpaceSize()
           
static Resource getHomeDirectory()
          returns the Hoome Directory of the System
static int getJREArch()
          return the JRE (Java Runtime Engine) architecture, this can be different from the operating system architecture
static double getLoaderVersion()
           
static Query getMemoryUsageAsQuery(int type)
           
static Struct getMemoryUsageAsStruct(int type)
           
static Struct getMemoryUsageCompact(int type)
           
static int getOSArch()
          return the operating system architecture
static String getOSSpecificLineSeparator()
           
static MemoryPoolMXBean getPermGenSpaceBean()
           
static PrintWriter getPrintWriter(int type)
           
static String getPropertyEL(String key)
           
static Resource getRuningContextRoot()
           
static Resource getSystemDirectory()
           
static Resource getTempDirectory()
          returns the Temp Directory of the System
static Resource getTempFile(String extension, boolean touch)
          returns the a unique temp file (with no auto delete)
static long getTotalBytes()
           
static long getUsedMemory()
           
static String hash(javax.servlet.ServletContext sc)
           
static boolean isCLICall()
           
static boolean isFSCaseSensitive()
          returns if the file system case sensitive or not
static boolean isUnix()
           
static boolean isWindows()
           
static void join(Thread t)
           
static long microTime()
           
static void notify(Object lock)
          locks the object (synchronized) before calling notify
static void notifyAll(Object lock)
          locks the object (synchronized) before calling notifyAll
static String parsePlaceHolder(String path)
          replace path placeholder with the real path, placeholders are [{temp-directory},{system-directory},{home-directory}]
static String parsePlaceHolder(String path, javax.servlet.ServletContext sc)
           
static String parsePlaceHolder(String path, javax.servlet.ServletContext sc, Map<String,String> labels)
           
static void setCharset(String charset)
           
static void setPrintWriter(int type, PrintWriter pw)
           
static void sleep(int time)
           
static void sleep(long time)
           
static void wait(Object lock)
          locks the object (synchronized) before calling wait (no timeout)
static void wait(Object lock, long timeout)
          locks the object (synchronized) before calling wait
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEMORY_TYPE_ALL

public static final int MEMORY_TYPE_ALL
See Also:
Constant Field Values

MEMORY_TYPE_HEAP

public static final int MEMORY_TYPE_HEAP
See Also:
Constant Field Values

MEMORY_TYPE_NON_HEAP

public static final int MEMORY_TYPE_NON_HEAP
See Also:
Constant Field Values

ARCH_UNKNOW

public static final int ARCH_UNKNOW
See Also:
Constant Field Values

ARCH_32

public static final int ARCH_32
See Also:
Constant Field Values

ARCH_64

public static final int ARCH_64
See Also:
Constant Field Values

CHAR_DOLLAR

public static final char CHAR_DOLLAR
See Also:
Constant Field Values

CHAR_POUND

public static final char CHAR_POUND
See Also:
Constant Field Values

CHAR_EURO

public static final char CHAR_EURO
See Also:
Constant Field Values

OUT

public static final int OUT
See Also:
Constant Field Values

ERR

public static final int ERR
See Also:
Constant Field Values

osArch

public static int osArch

jreArch

public static int jreArch
Constructor Detail

SystemUtil

public SystemUtil()
Method Detail

getPermGenSpaceBean

public static MemoryPoolMXBean getPermGenSpaceBean()

isFSCaseSensitive

public static boolean isFSCaseSensitive()
returns if the file system case sensitive or not

Returns:
is the file system case sensitive or not

isWindows

public static boolean isWindows()
Returns:
is local machine a Windows Machine

isUnix

public static boolean isUnix()
Returns:
is local machine a Unix Machine

getSystemDirectory

public static Resource getSystemDirectory()
Returns:
return System directory

getRuningContextRoot

public static Resource getRuningContextRoot()
Returns:
return running context root

getTempDirectory

public static Resource getTempDirectory()
returns the Temp Directory of the System

Returns:
temp directory

getTempFile

public static Resource getTempFile(String extension,
                                   boolean touch)
                            throws IOException
returns the a unique temp file (with no auto delete)

Parameters:
extension -
Returns:
temp directory
Throws:
IOException

getHomeDirectory

public static Resource getHomeDirectory()
returns the Hoome Directory of the System

Returns:
home directory

getClassLoadeDirectory

public static Resource getClassLoadeDirectory()

getClassPathes

public static Resource[] getClassPathes()
Returns:
returns a string list of all pathes

getUsedMemory

public static long getUsedMemory()

getAvailableMemory

public static long getAvailableMemory()

parsePlaceHolder

public static String parsePlaceHolder(String path)
replace path placeholder with the real path, placeholders are [{temp-directory},{system-directory},{home-directory}]

Parameters:
path -
Returns:
updated path

addPlaceHolder

public static String addPlaceHolder(Resource file,
                                    String defaultValue)

addPlaceHolder

public static String addPlaceHolder(Resource file,
                                    Config config,
                                    String defaultValue)

parsePlaceHolder

public static String parsePlaceHolder(String path,
                                      javax.servlet.ServletContext sc,
                                      Map<String,String> labels)

parsePlaceHolder

public static String parsePlaceHolder(String path,
                                      javax.servlet.ServletContext sc)

hash

public static String hash(javax.servlet.ServletContext sc)

getCharset

public static String getCharset()

setCharset

public static void setCharset(String charset)

getOSSpecificLineSeparator

public static String getOSSpecificLineSeparator()

sleep

public static void sleep(int time)

sleep

public static void sleep(long time)

join

public static void join(Thread t)

wait

public static void wait(Object lock,
                        long timeout)
locks the object (synchronized) before calling wait

Parameters:
lock -
timeout -
Throws:
InterruptedException

wait

public static void wait(Object lock)
locks the object (synchronized) before calling wait (no timeout)

Parameters:
lock -
Throws:
InterruptedException

notify

public static void notify(Object lock)
locks the object (synchronized) before calling notify

Parameters:
lock -
timeout -
Throws:
InterruptedException

notifyAll

public static void notifyAll(Object lock)
locks the object (synchronized) before calling notifyAll

Parameters:
lock -
timeout -
Throws:
InterruptedException

getOSArch

public static int getOSArch()
return the operating system architecture

Returns:
one of the following SystemUtil.ARCH_UNKNOW, SystemUtil.ARCH_32, SystemUtil.ARCH_64

getJREArch

public static int getJREArch()
return the JRE (Java Runtime Engine) architecture, this can be different from the operating system architecture

Returns:
one of the following SystemUtil.ARCH_UNKNOW, SystemUtil.ARCH_32, SystemUtil.ARCH_64

getAddressSize

public static int getAddressSize()

getFreePermGenSpaceSize

public static long getFreePermGenSpaceSize()

getFreePermGenSpacePromille

public static int getFreePermGenSpacePromille()

getMemoryUsageAsQuery

public static Query getMemoryUsageAsQuery(int type)
                                   throws DatabaseException
Throws:
DatabaseException

getMemoryUsageAsStruct

public static Struct getMemoryUsageAsStruct(int type)

getMemoryUsageCompact

public static Struct getMemoryUsageCompact(int type)

getPropertyEL

public static String getPropertyEL(String key)

microTime

public static long microTime()

getCurrentContext

public static SystemUtil.TemplateLine getCurrentContext()

getFreeBytes

public static long getFreeBytes()
                         throws ApplicationException
Throws:
ApplicationException

getTotalBytes

public static long getTotalBytes()
                          throws ApplicationException
Throws:
ApplicationException

getCpuUsage

public static double getCpuUsage(long time)
                          throws ApplicationException
Throws:
ApplicationException

setPrintWriter

public static void setPrintWriter(int type,
                                  PrintWriter pw)

getPrintWriter

public static PrintWriter getPrintWriter(int type)

isCLICall

public static boolean isCLICall()

getLoaderVersion

public static double getLoaderVersion()


Copyright © 2012 Railo