net.sourceforge.jinit
Class Util

java.lang.Object
  extended by net.sourceforge.jinit.Util

public class Util
extends Object

Provides some utility methods.

Author:
Trevor Miller

Method Summary
static Object[] commaSepListAsArray(String list)
          Convert a comma separated list into an object array.
static void createFromClasspath(File result, String resource)
          Create a file by reading a resource from the classpath.
static Properties getProperties()
          Provide date and time properties.
static String loadFile(File file)
          Load a character file's contents into a string.
static Properties loadProperties(String source)
          Load a properties object from a string.
static String propsToString(Properties properties)
          Convert properties to a human readable string for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

commaSepListAsArray

public static Object[] commaSepListAsArray(String list)
Convert a comma separated list into an object array.

Parameters:
list - The list.
Returns:
Object array containing Strings.

loadProperties

public static Properties loadProperties(String source)
Load a properties object from a string.

Parameters:
source - The string to use
Returns:
Properties object

loadFile

public static String loadFile(File file)
                       throws IOException
Load a character file's contents into a string.

Parameters:
file - The file to read from
Returns:
String representing the contents of the fil
Throws:
IOException - If an error occurs

getProperties

public static Properties getProperties()
Provide date and time properties.

Returns:
Properties object with date and time props

propsToString

public static String propsToString(Properties properties)
Convert properties to a human readable string for debugging.

Parameters:
properties - The properties to convert
Returns:
String representation of the properties

createFromClasspath

public static void createFromClasspath(File result,
                                       String resource)
                                throws Exception
Create a file by reading a resource from the classpath.

Parameters:
result - The resulting file to create
resource - The resource to load from the classpath
Throws:
Exception - If an error occurs


Copyright © 2005 JInit Project. All Rights Reserved.