|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xnap.util.Formatter
public class Formatter
Helper class providing static methods for formatting different number and date formats.
| Field Summary | |
|---|---|
static int |
CENTER
|
static int |
LEFT
|
static int |
RIGHT
|
static java.lang.String[] |
SIZES
|
| Constructor Summary | |
|---|---|
Formatter()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
fill(java.lang.String s,
int count)
Creates a string from a string being count times appended
to itself. |
static java.lang.String |
formatDate(java.util.Date date)
Formats date. |
static java.lang.String |
formatLength(long i)
Formats number of seconds in appropriate time unit |
static java.lang.String |
formatNumber(double number)
Formats a number without any digits in the fraction portion. |
static java.lang.String |
formatNumber(double number,
int decimal)
Formats double as decimal number. |
static java.lang.String |
formatSize(double size)
Returns value (byte) formatted as a file size. |
static java.lang.String |
formatTable(java.lang.String[] rows,
int[] colAlignment)
Formats a row of strings according to given alignments for the console output. |
static java.lang.String |
formatTime(long time)
Formats time from given milliseconds time value. |
static java.lang.String |
getCLFDate()
Returns the current date in the format needed for CLF. |
static java.lang.String |
shortDate()
Returns a string of the current date in short format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final java.lang.String[] SIZES
| Constructor Detail |
|---|
public Formatter()
| Method Detail |
|---|
public static java.lang.String formatNumber(double number,
int decimal)
number - number to be formatteddecimal - the number of digits allowed in the fraction portion of
a number
public static java.lang.String formatNumber(double number)
number - number to be formatted
public static java.lang.String formatSize(double size)
value (byte) formatted as a file size.
For example value=2048 returns "2 kb".
size - filesize to be formatted
public static java.lang.String formatLength(long i)
i - number of seconds
public static java.lang.String formatDate(java.util.Date date)
public static java.lang.String formatTime(long time)
time - milliseconds since January 1, 1970, 00:00:00 GMT not to
exceed the milliseconds representation for the year 8099. A negative
number indicates the number of milliseconds before January 1, 1970,
00:00:00 GMT.
public static java.lang.String formatTable(java.lang.String[] rows,
int[] colAlignment)
rows - array of strings to be formattedcolAlignment - array of alignment policies
public static java.lang.String fill(java.lang.String s,
int count)
count times appended
to itself.
s - stringcount - number of times it's appended to itselfpublic static java.lang.String getCLFDate()
public static java.lang.String shortDate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||