phelps.text

Class Formats

public class Formats extends Object

Pretty printing.

Version: $Revision: 1.4 $ $Date: 2003/07/26 02:14:32 $

Method Summary
static longparseDate(String sdate)
Parse sdate and pass on to Formats.
static Stringpretty(Rectangle2D r)
Compact output for a Rectangle: widthxheight @ (x,y).
static StringprettySeconds(int sec)
Formats seconds as days/HH:MM:SS.
static StringprettySize(long bytes)
Given a byte count, returns a string in more human-readable form; e.g., 13*1024*1024 => "13MB".
static StringrelativeDate(long date)
Display date relative to now.
static StringrelativeDate(long date, long relativeTo)
Display date, in the standard Java milliseconds since 1970, relative to relativeTo, using relations like "yesterday" and "3 hours ago".

Method Detail

parseDate

public static long parseDate(String sdate)
Parse sdate and pass on to Formats. sdate can either be a number, in the standard Java milliseconds since 1970, or a human-readable date that was produced by java.util.Date#toString().

pretty

public static String pretty(Rectangle2D r)
Compact output for a Rectangle: widthxheight @ (x,y).

prettySeconds

public static String prettySeconds(int sec)
Formats seconds as days/HH:MM:SS.

prettySize

public static String prettySize(long bytes)
Given a byte count, returns a string in more human-readable form; e.g., 13*1024*1024 => "13MB".

relativeDate

public static String relativeDate(long date)
Display date relative to now.

relativeDate

public static String relativeDate(long date, long relativeTo)
Display date, in the standard Java milliseconds since 1970, relative to relativeTo, using relations like "yesterday" and "3 hours ago".