Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.makumba.commons
Class ReadableFormatter

    java.lang.Object
      org.makumba.commons.ReadableFormatter

    public class ReadableFormatter

extends Object

Formats argument in a readable (meaningful) way

Version:
  $Id: ReadableFormatter.java 2639 2008-06-24 22:07:04Z rosso_nero $
Author:
  Stefan Baebler

Constructor Summary
`ReadableFormatter()`

Method Summary
`static String` | `readableAge(long milis)` Formats lentgh of time periods in a nice format
`static String` | `readableBytes(long byteSize)` Formats byte size in nice format
`static String` | `readableBytes(String byteSize)` Formats byte size in nice format - a wrapper method
`static String` | `readableDate(Date date)` prints date in nice format - only relevant parts Skips year if current, shows time if today...

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReadableFormatter

    public ReadableFormatter()

Method Detail

### readableBytes

    public static String readableBytes(String byteSize)

  Formats byte size in nice format - a wrapper method

  Parameters:
    `byteSize` - `String` representing the byte size
  Returns:
    Formatted number of bytes (eg: empty, 15 B, 12kB, 821 kB, 3 MB...)
    "N/A" if `byteSize` is not a number
    "" if `byteSize` is null
  See Also:
    `readableBytes(long)`

### readableBytes

    public static String readableBytes(long byteSize)

  Formats byte size in nice format

  Parameters:
    `byteSize` - the size in bytes to format
  Returns:
    Formatted number of bytes (eg: empty, 15 B, 12kB, 821 kB, 3 MB...)
  See Also:
    `readableBytes(String)`

### readableAge

    public static String readableAge(long milis)

  Formats lentgh of time periods in a nice format

  Parameters:
    `milis` - a time difference in milli-seconds to format
  Returns:
    formatted time (eg: "1 second", "3 hours", "2 weeks" "41 years"...)

### readableDate

    public static String readableDate(Date date)

  prints date in nice format - only relevant parts Skips year if current, shows time if today...

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Docs generated on 2009-02-25 14:20