org.apache.james.util
Class TimeConverter

java.lang.Object
  extended by org.apache.james.util.TimeConverter

public class TimeConverter
extends java.lang.Object


Method Summary
static long getMilliSeconds(long amount, java.lang.String unit)
          Helper method to get the milliseconds for the given amount and unit
static long getMilliSeconds(java.lang.String rawString)
          Helper method to get the milliseconds for the given rawstring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMilliSeconds

public static long getMilliSeconds(long amount,
                                   java.lang.String unit)
                            throws java.lang.NumberFormatException
Helper method to get the milliseconds for the given amount and unit

Parameters:
amount - The amount for use with the unit
unit - The unit
Returns:
The time in milliseconds
Throws:
java.lang.NumberFormatException - Get thrown if an illegal unit was used

getMilliSeconds

public static long getMilliSeconds(java.lang.String rawString)
                            throws java.lang.NumberFormatException
Helper method to get the milliseconds for the given rawstring. Allowed rawstrings must mach pattern: "\\s*([0-9]+)\\s*([a-z,A-Z]+)\\s*"

Parameters:
rawString - The rawstring which we use to extract the amount and unit
Returns:
The time in milliseconds
Throws:
java.lang.NumberFormatException - Get thrown if an illegal rawString was used


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.