at.spardat.xma.boot.util
Class Util

java.lang.Object
  extended byat.spardat.xma.boot.util.Util

public class Util
extends java.lang.Object

class: CDBUtil


Method Summary
static void close(java.io.InputStream is, java.lang.String id)
          Closes as stream and logs an eventual Exception.
static void close(java.io.OutputStream os, java.lang.String id)
          Closes as stream and logs an eventual Exception.
 boolean compare(java.lang.String s1, java.lang.String s2, boolean ignore)
          Compare strings that can be null
 java.lang.String fixPath(java.lang.String in)
          Clean up a string by removing characters that can't/should not appear in a local file_ name.
 void fixPath(java.lang.StringBuffer path)
          Clean up a string by removing characters that can't/should not appear in a local file_ name.
static Util getInstance()
          Get the single instance of Util.
 java.util.Locale getLocale(java.lang.String localeStr)
          Parse a Locale from String
 void removeApplicationRecursive(java.io.File filedir, Logger log_)
          remove a directory and all itīs content
 boolean urlEquals(java.net.URL u1, java.net.URL u2)
          Compares a URL using string compare of its protocol, host, port, path, query, and anchor.
 java.lang.StringBuffer urlToPath(java.net.URL location)
          Converts a URL into a local, relative path representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Util getInstance()
Get the single instance of Util. If no instance exists it is created.

Returns:
the singleton Util

urlToPath

public java.lang.StringBuffer urlToPath(java.net.URL location)
Converts a URL into a local, relative path representation.

Parameters:
location - the url
Returns:
the file_

getLocale

public java.util.Locale getLocale(java.lang.String localeStr)
Parse a Locale from String

Parameters:
localeStr - the locale string to be parsed.
It is save with "null" as input

compare

public boolean compare(java.lang.String s1,
                       java.lang.String s2,
                       boolean ignore)
Compare strings that can be null

Parameters:
s1 - string-input
s2 - string-input
ignore - true will ignore case
Returns:
true if equal otherwise false

urlEquals

public boolean urlEquals(java.net.URL u1,
                         java.net.URL u2)
Compares a URL using string compare of its protocol, host, port, path, query, and anchor. This method avoids the host name lookup that URL.equals does for http: protocol URLs. It may not return the same value as the URL.equals method ( different hostnames that resolve to the same IP address )

Parameters:
u1 - compare input 1
u2 - compare input 2
Returns:
true if equal

fixPath

public java.lang.String fixPath(java.lang.String in)
Clean up a string by removing characters that can't/should not appear in a local file_ name.

Parameters:
in - the file path to fix
Returns:
the fixed file path

fixPath

public void fixPath(java.lang.StringBuffer path)
Clean up a string by removing characters that can't/should not appear in a local file_ name.

Parameters:
path - the path to fix. Bad characters are replaced in this StringBuffer.

removeApplicationRecursive

public void removeApplicationRecursive(java.io.File filedir,
                                       Logger log_)
remove a directory and all itīs content

Parameters:
filedir - the directory to remove
log_ - where to report any errors

close

public static void close(java.io.OutputStream os,
                         java.lang.String id)
Closes as stream and logs an eventual Exception.

Parameters:
os - the output stream to close
id - identifieing the stream e.g.: the filename
Since:
1.3.1

close

public static void close(java.io.InputStream is,
                         java.lang.String id)
Closes as stream and logs an eventual Exception.

Parameters:
is - the input stream to close
id - identifieing the stream e.g.: the filename
Since:
1.3.1