railo.loader.util
Class Util

java.lang.Object
  extended byrailo.loader.util.Util

public class Util
extends java.lang.Object

Util class for different little jobs


Constructor Summary
Util()
           
 
Method Summary
static void closeEL(java.io.InputStream is)
          close inputstream without a Exception
static void closeEL(java.io.InputStream is, java.io.OutputStream os)
          close inputstream without a Exception
static void closeEL(java.io.OutputStream os)
          close outputstream without a Exception
static void closeEL(java.io.Reader r)
          close reader without a Exception
static void closeEL(java.io.Writer w)
          close reader without a Exception
static void copy(java.io.InputStream in, java.io.OutputStream out)
          copy a inputstream to a outputstream
static void copy(Resource in, Resource out)
           
static java.io.File getCanonicalFileEL(java.io.File file)
          Returns the canonical form of this abstract pathname.
static java.lang.String getContentAsString(java.io.InputStream is, java.lang.String charset)
           
static java.io.File getHomeDirectory()
          returns the Hoome Directory of the System
static java.io.File getSystemDirectory()
           
static java.io.File getTempDirectory()
          returns the Temp Directory of the System
static boolean hasUpperCase(java.lang.String str)
           
static boolean isEmpty(java.lang.String str)
          check if string is empty (null or "")
static boolean isEmpty(java.lang.String str, boolean trim)
          check if string is empty (null or "")
static int length(java.lang.String str)
           
static void main(java.lang.String[] args)
           
static java.lang.String parsePlaceHolder(java.lang.String path)
          replace path placeholder with the real path, placeholders are [{temp-directory},{system-directory},{home-directory}]
static java.lang.String replace(java.lang.String str, java.lang.String sub1, java.lang.String sub2, boolean onlyFirst)
           
static boolean toBooleanValue(java.lang.String str)
           
static java.io.BufferedInputStream toBufferedInputStream(java.io.InputStream is)
           
static java.io.BufferedOutputStream toBufferedOutputStream(java.io.OutputStream os)
           
static java.lang.String toHTTPTimeString()
           
static java.lang.String toHTTPTimeString(java.util.Date date)
           
static int toInVersion(java.lang.String version)
          cast a railo string version to a int version
static java.lang.String toString(java.io.InputStream is)
          read String data from a InputStream and returns it as String Object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

copy

public static final void copy(java.io.InputStream in,
                              java.io.OutputStream out)
                       throws java.io.IOException
copy a inputstream to a outputstream

Parameters:
in -
out -
Throws:
java.io.IOException

toString

public static java.lang.String toString(java.io.InputStream is)
                                 throws java.io.IOException
read String data from a InputStream and returns it as String Object

Parameters:
is - InputStream to read data from.
Returns:
readed data from InputStream
Throws:
java.io.IOException

toBooleanValue

public static boolean toBooleanValue(java.lang.String str)
                              throws java.io.IOException
Throws:
java.io.IOException

closeEL

public static void closeEL(java.io.InputStream is,
                           java.io.OutputStream os)
close inputstream without a Exception

Parameters:
is -
os -

closeEL

public static void closeEL(java.io.InputStream is)
close inputstream without a Exception

Parameters:
is -

closeEL

public static void closeEL(java.io.Reader r)
close reader without a Exception


closeEL

public static void closeEL(java.io.Writer w)
close reader without a Exception


closeEL

public static void closeEL(java.io.OutputStream os)
close outputstream without a Exception

Parameters:
os -

getContentAsString

public static java.lang.String getContentAsString(java.io.InputStream is,
                                                  java.lang.String charset)
                                           throws java.io.IOException
Parameters:
is - inputStream to get content From
charset -
Returns:
returns content from a file inputed by input stream
Throws:
java.io.IOException

isEmpty

public static boolean isEmpty(java.lang.String str)
check if string is empty (null or "")

Parameters:
str -
Returns:
is empty or not

isEmpty

public static boolean isEmpty(java.lang.String str,
                              boolean trim)
check if string is empty (null or "")

Parameters:
str -
Returns:
is empty or not

length

public static int length(java.lang.String str)

toInVersion

public static int toInVersion(java.lang.String version)
cast a railo string version to a int version

Parameters:
version -
Returns:
int version

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String sub1,
                                       java.lang.String sub2,
                                       boolean onlyFirst)
Parameters:
str - String to work with
sub1 - value to replace
sub2 - replacement
onlyFirst - replace only first or all
Returns:
new String

parsePlaceHolder

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

Parameters:
path -
Returns:
updated path

getTempDirectory

public static java.io.File getTempDirectory()
returns the Temp Directory of the System

Returns:
temp directory

getHomeDirectory

public static java.io.File getHomeDirectory()
returns the Hoome Directory of the System

Returns:
home directory

getSystemDirectory

public static java.io.File getSystemDirectory()
Returns:
return System directory

getCanonicalFileEL

public static java.io.File getCanonicalFileEL(java.io.File file)
Returns the canonical form of this abstract pathname.

Parameters:
file - file to get canoncial form from it
Returns:
The canonical pathname string denoting the same file or directory as this abstract pathname
Throws:
java.lang.SecurityException - If a required system property value cannot be accessed.

main

public static void main(java.lang.String[] args)

toHTTPTimeString

public static java.lang.String toHTTPTimeString(java.util.Date date)

toHTTPTimeString

public static java.lang.String toHTTPTimeString()

hasUpperCase

public static boolean hasUpperCase(java.lang.String str)

toBufferedInputStream

public static java.io.BufferedInputStream toBufferedInputStream(java.io.InputStream is)

toBufferedOutputStream

public static java.io.BufferedOutputStream toBufferedOutputStream(java.io.OutputStream os)

copy

public static void copy(Resource in,
                        Resource out)
                 throws java.io.IOException
Throws:
java.io.IOException