org.kuali.common.aws.s3
Class SimpleFormatter

java.lang.Object
  extended by org.kuali.common.aws.s3.SimpleFormatter

public class SimpleFormatter
extends Object

Format time, bytes, counts, and transfer rate into human friendly form

Since:
May 27, 2010 6:46:17 PM
Author:
Jeff Caddel

Constructor Summary
SimpleFormatter()
           
 
Method Summary
 String getCount(long count)
          Return a formatted count
 String getDate(Date date)
          Return a formatted date
 String getDate(long millis)
          Return a formatted date
 String getFormattedSize(long bytes, Size size)
           
 NumberFormat getLargeSizeFormatter()
           
 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
 NumberFormat getRateFormatter()
           
 String getSize(long bytes)
          Given a number of bytes return bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes as appropriate.
 String getSize(long bytes, Size size)
          Given a number of bytes return bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes as appropriate.
 Size getSizeEnum(double bytes)
           
 NumberFormat getSizeFormatter()
           
 String getTime(long millis)
          Given milliseconds, return milliseconds, seconds, minutes, hours, days, years, decades, or centuries as appropriate.
 NumberFormat getTimeFormatter()
           
protected  boolean needsSpaceBeforeLabel(Size size)
           
 void setLargeSizeFormatter(NumberFormat sizeFormatter)
           
 void setRateFormatter(NumberFormat rateFormatter)
           
 void setSizeFormatter(NumberFormat smallSizeFormatter)
           
 void setTimeFormatter(NumberFormat timeFormatter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleFormatter

public SimpleFormatter()
Method Detail

getDate

public String getDate(long millis)
Return a formatted date


getDate

public String getDate(Date date)
Return a formatted date


getRate

public 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 String getCount(long count)
Return a formatted count


getTime

public 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 String getSize(long bytes)
Given a number of bytes return bytes, kilobytes, megabytes, gigabytes, terabytes, petabytes, or exabytes as appropriate.


getSize

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


needsSpaceBeforeLabel

protected boolean needsSpaceBeforeLabel(Size size)

getFormattedSize

public String getFormattedSize(long bytes,
                               Size size)

getSizeEnum

public Size getSizeEnum(double bytes)

getLargeSizeFormatter

public NumberFormat getLargeSizeFormatter()

setLargeSizeFormatter

public void setLargeSizeFormatter(NumberFormat sizeFormatter)

getTimeFormatter

public NumberFormat getTimeFormatter()

setTimeFormatter

public void setTimeFormatter(NumberFormat timeFormatter)

getRateFormatter

public NumberFormat getRateFormatter()

setRateFormatter

public void setRateFormatter(NumberFormat rateFormatter)

getSizeFormatter

public NumberFormat getSizeFormatter()

setSizeFormatter

public void setSizeFormatter(NumberFormat smallSizeFormatter)


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.