edu.sdsc.inca.util
Class StringMethods

java.lang.Object
  extended byedu.sdsc.inca.util.StringMethods

public class StringMethods
extends java.lang.Object

A class of useful static utility methods that really fit elsewhere.

Author:
Jim Hayes <jhayes@sdsc.edu>

Constructor Summary
StringMethods()
           
 
Method Summary
static int compareTo(java.lang.String left, java.lang.String right)
          Returns an indicator of the relationship between two operands.
static java.lang.String fileContents(java.lang.String path)
          Returns the contents of a specified file as a String, with lines from the file delimited by newlines (\n).
static java.lang.String join(java.lang.String separator, java.lang.String[] values)
          Joins the separate strings in values into a single string with fields separated by the value of separator and returns that new string.
static void sendEmail(java.lang.String address, java.lang.String subject, java.lang.String message)
          Send a notification email to the specified email address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMethods

public StringMethods()
Method Detail

compareTo

public static int compareTo(java.lang.String left,
                            java.lang.String right)
Returns an indicator of the relationship between two operands.

Parameters:
left - the left operand
right - the right operand
Returns:
a negative number if left < right, a positive number if left > right, 0 if the two are equal

fileContents

public static java.lang.String fileContents(java.lang.String path)
                                     throws java.io.IOException
Returns the contents of a specified file as a String, with lines from the file delimited by newlines (\n).

Parameters:
path - the path to the file to read
Returns:
the file contents
Throws:
java.io.IOException - on an open/read error

join

public static java.lang.String join(java.lang.String separator,
                                    java.lang.String[] values)
Joins the separate strings in values into a single string with fields separated by the value of separator and returns that new string.

Parameters:
separator - The string that will separate the values.
values - The list of strings that should be joined
Returns:
The new joined string.

sendEmail

public static void sendEmail(java.lang.String address,
                             java.lang.String subject,
                             java.lang.String message)
Send a notification email to the specified email address.

Parameters:
address - The email address to send the email to.
subject - The subject of the email.
message - The message body of the email