net.sf.jameleon.util
Class JameleonUtility

java.lang.Object
  extended by net.sf.jameleon.util.JameleonUtility

public class JameleonUtility
extends Object


Method Summary
protected static void closeInputStream(InputStream is)
           
static String convertNullToString(String str)
           
static void createDirStructure(File f)
          Ensures that a directory structure is created.
static String createErrMsg(String msg)
          Formats the error message.
static String decodeTextToXML(String str)
           
static String decodeXMLToText(String str)
           
static void deleteDirStructure(File f)
          Deletes the given directory/file and all child files.
static String executionTimeToString(long time)
           
static String fixFileSeparators(String path)
           
static String fixFileSeparators(String path, String fileSeparator)
           
static String getEndingPath(File path, String file)
           
static String getEndingPath(String path, File file)
           
static String getEndingPath(String path, String file)
           
static String getFileNameFromPath(String path)
           
static String getFileNameFromScriptPath(String path)
           
static InputStream getInputStream(String className, Object callingClass)
           
static String getStack(Throwable t)
          A helper method to get the stack track of a throwable as a String
static FunctionalPoint loadFunctionalPoint(String className, Object callingClass)
           
static void recordResultsToFile(File f, String content)
          Write some text to a file who's directory may or may not exist.
static void recordResultsToFile(File f, String content, String encoding)
          Write some text to a file who's directory may or may not exist.
static String stripHtmlComments(String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadFunctionalPoint

public static FunctionalPoint loadFunctionalPoint(String className,
                                                  Object callingClass)

closeInputStream

protected static void closeInputStream(InputStream is)

getInputStream

public static InputStream getInputStream(String className,
                                         Object callingClass)

getStack

public static String getStack(Throwable t)
A helper method to get the stack track of a throwable as a String

Parameters:
t - The exception to get the stack trace from.
Returns:
The stack trace as a String.

createErrMsg

public static String createErrMsg(String msg)
Formats the error message.

Parameters:
msg - - The message to format.
Returns:
The formatted msg.

recordResultsToFile

public static void recordResultsToFile(File f,
                                       String content)
                                throws IOException
Write some text to a file who's directory may or may not exist.

Parameters:
f - - The file to write to.
content - - The content to write.
Throws:
IOException - - If the directory structure could not be created or if the file could not be written to.

recordResultsToFile

public static void recordResultsToFile(File f,
                                       String content,
                                       String encoding)
                                throws IOException
Write some text to a file who's directory may or may not exist.

Parameters:
f - - The file to write to.
content - - The content to write.
encoding - - The encoding type to write to.
Throws:
IOException - - If the directory structure could not be created or if the file could not be written to.

createDirStructure

public static void createDirStructure(File f)
Ensures that a directory structure is created.

Parameters:
f - The directory to create the structure.

deleteDirStructure

public static void deleteDirStructure(File f)
Deletes the given directory/file and all child files.

Parameters:
f - The directory/file to delete.

decodeXMLToText

public static String decodeXMLToText(String str)

decodeTextToXML

public static String decodeTextToXML(String str)

executionTimeToString

public static String executionTimeToString(long time)

stripHtmlComments

public static String stripHtmlComments(String text)

convertNullToString

public static String convertNullToString(String str)

getEndingPath

public static String getEndingPath(String path,
                                   String file)

getEndingPath

public static String getEndingPath(String path,
                                   File file)

getEndingPath

public static String getEndingPath(File path,
                                   String file)

getFileNameFromPath

public static String getFileNameFromPath(String path)

getFileNameFromScriptPath

public static String getFileNameFromScriptPath(String path)

fixFileSeparators

public static String fixFileSeparators(String path)
Parameters:
path - a path using forward slashes
Returns:
the original path with all forward slashes replaced by unix slash

fixFileSeparators

public static String fixFileSeparators(String path,
                                       String fileSeparator)
Parameters:
path - a path using forward slashes
fileSeparator - the character to replace the forward slashes
Returns:
the original path with all forward slashes replaced by fileSeparator


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.