org.vrspace.util
Class Util

java.lang.Object
  extended byorg.vrspace.util.Util

public class Util
extends java.lang.Object

Miscelanous usefull methods


Constructor Summary
Util()
           
 
Method Summary
static java.lang.String checkPath(java.lang.String path)
          Changes ":" to "\" in path, then all instances of "\" to "/".
static java.io.FileOutputStream createFileOutputStream(java.lang.String destPath)
          Creates FileOutputStream in destPath, with directiories as needed
static java.lang.String getClassName(java.lang.Class cls)
           
static java.lang.String getClassName(java.lang.Object obj)
           
static java.lang.String getDir(java.lang.String path)
          Returns directory part of a file name
static java.net.URL getLocation(java.lang.Object obj)
          Returns the location of the class file
static java.lang.String getPackageName(java.lang.Class cls)
          Returns package name for a class
static java.lang.String getPackageName(java.lang.Object obj)
           
static boolean hasVrmlExtension(java.lang.String path)
          true if the file has the extension .wrl (not e.g.
static java.util.Properties loadProperties(java.util.Properties props, java.lang.String file)
          Loads properties from file into props
static java.lang.Object pop()
          pop from static Stack
static void push(java.lang.Object obj)
          push obj to static Stack
static void setDefaultProperty(java.util.Properties props, java.lang.String name, java.lang.String defaultValue)
          Sets the property name to defaultValue if not null, or to the system property if exists, only if it does not already exist in props
static void sleep(long millis)
          I hate catching InterruptedException!
static void storeProperties(java.util.Properties props, java.lang.String file)
          Stores the properties from props to file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

push

public static void push(java.lang.Object obj)
push obj to static Stack


pop

public static java.lang.Object pop()
pop from static Stack


getLocation

public static java.net.URL getLocation(java.lang.Object obj)
Returns the location of the class file


getDir

public static java.lang.String getDir(java.lang.String path)
Returns directory part of a file name


loadProperties

public static java.util.Properties loadProperties(java.util.Properties props,
                                                  java.lang.String file)
                                           throws java.io.FileNotFoundException,
                                                  java.io.IOException
Loads properties from file into props

Throws:
java.io.FileNotFoundException
java.io.IOException

storeProperties

public static void storeProperties(java.util.Properties props,
                                   java.lang.String file)
                            throws java.io.FileNotFoundException,
                                   java.io.IOException
Stores the properties from props to file

Throws:
java.io.FileNotFoundException
java.io.IOException

setDefaultProperty

public static void setDefaultProperty(java.util.Properties props,
                                      java.lang.String name,
                                      java.lang.String defaultValue)
Sets the property name to defaultValue if not null, or to the system property if exists, only if it does not already exist in props


createFileOutputStream

public static java.io.FileOutputStream createFileOutputStream(java.lang.String destPath)
                                                       throws java.io.IOException
Creates FileOutputStream in destPath, with directiories as needed

Throws:
java.io.IOException

sleep

public static void sleep(long millis)
I hate catching InterruptedException!


checkPath

public static java.lang.String checkPath(java.lang.String path)
Changes ":" to "\" in path, then all instances of "\" to "/".


hasVrmlExtension

public static boolean hasVrmlExtension(java.lang.String path)
true if the file has the extension .wrl (not e.g. .wrl.gz)


getPackageName

public static java.lang.String getPackageName(java.lang.Class cls)
Returns package name for a class


getPackageName

public static java.lang.String getPackageName(java.lang.Object obj)

getClassName

public static java.lang.String getClassName(java.lang.Class cls)

getClassName

public static java.lang.String getClassName(java.lang.Object obj)