org.kuali.common.util
Class FormatUtils

java.lang.Object
  extended by org.kuali.common.util.FormatUtils

public class FormatUtils
extends Object


Field Summary
protected static SimpleFormatter SF
           
 
Constructor Summary
FormatUtils()
           
 
Method Summary
static String getCount(long count)
          Return a formatted count
static String getDate(Date date)
          Return a formatted date
static String getDate(long millis)
          Return a formatted date
static String getFormattedSize(long bytes, Size size)
           
static String getRate(long millis, long bytes)
          Given a number of bytes and the number of milliseconds it took to transfer that number of bytes, return bytes/s, KB/s, MB/s, GB/s, TB/s, PB/s, or EB/s as appropriate
static String getSize(long bytes)
          Given a number of bytes return bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes as appropriate.
static String getSize(long bytes, Size unitOfMeasure)
          Given a number of bytes return a string formatted into the unit of measure indicated
static Size getSizeEnum(double bytes)
           
static String getTime(long millis)
          Given milliseconds, return milliseconds, seconds, minutes, hours, days, years, decades, or centuries as appropriate.
static Date parseDate(String date)
          Parse a date from the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SF

protected static SimpleFormatter SF
Constructor Detail

FormatUtils

public FormatUtils()
Method Detail

parseDate

public static Date parseDate(String date)
Parse a date from the string. The string must be in the same format returned by the getDate() methods


getDate

public static String getDate(long millis)
Return a formatted date


getDate

public static String getDate(Date date)
Return a formatted date


getRate

public static String getRate(long millis,
                             long bytes)
Given a number of bytes and the number of milliseconds it took to transfer that number of bytes, return bytes/s, KB/s, MB/s, GB/s, TB/s, PB/s, or EB/s as appropriate


getCount

public static String getCount(long count)
Return a formatted count


getTime

public static String getTime(long millis)
Given milliseconds, return milliseconds, seconds, minutes, hours, days, years, decades, or centuries as appropriate. Note that years, decades, and centuries are approximations since the logic always assumes there are exactly 365 days per year.


getSize

public static String getSize(long bytes)
Given a number of bytes return bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes as appropriate.


getSize

public static String getSize(long bytes,
                             Size unitOfMeasure)
Given a number of bytes return a string formatted into the unit of measure indicated


getFormattedSize

public static String getFormattedSize(long bytes,
                                      Size size)

getSizeEnum

public static Size getSizeEnum(double bytes)


Copyright © 2010-2013 The Kuali Foundation. All Rights Reserved.