public class FormatUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FormatUtil.DurationFormatStyle |
Constructor and Description |
---|
FormatUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
customToString(java.lang.Throwable ex)
Returns true if the given throwable uses a custom implementation of toString()
|
static java.lang.String |
formatByteSize(long numBytes)
Formats a size of bytes, appropriately rounding to bytes, kb, mb, etc
|
static java.lang.String |
formatDateFull(java.util.Date value)
Returns a date formated to yyyy-MM-dd hh:mm:ss.S
|
static java.lang.String |
formatDuration(java.util.Locale locale,
long millis)
Formats a number of milliseconds as a human-readable string, like "5 hours, 35 minutes, 28 seconds"
|
static java.lang.String |
formatDuration(java.util.Locale locale,
long millis,
FormatUtil.DurationFormatStyle style) |
static java.lang.String |
formatDuration(java.util.Locale locale,
long millis,
FormatUtil.DurationFormatStyle style,
boolean alwaysShowMillis) |
static java.lang.String |
formatDuration(long millis)
Formats a number of milliseconds as a human-readable string, like "5 hours, 35 minutes, 28 seconds"
|
static java.lang.String |
formatDuration(long millis,
FormatUtil.DurationFormatStyle style) |
static java.lang.String |
formatDurationSince(long millisStart)
Shortcut, equivalent to formatDuration(System.currentTimeMillis()-millisStart)
|
static java.lang.String |
formatDurationSince(long millisStart,
FormatUtil.DurationFormatStyle style) |
static java.lang.String |
formatDurationSinceNano(long nanoStart)
Convenience function for using nanoTime for diffs.
|
static java.lang.String |
formatSafe(org.apache.log4j.Logger log,
java.lang.String value,
java.lang.Object... formatArgs)
Performs String.format() on the value, with the provided args, but catches the IllegalFormatException that the
function might throw.
|
static java.lang.String |
formatSafe(java.lang.String value,
java.lang.Object... formatArgs)
Performs String.format() on the value, with the provided args, but catches the IllegalFormatException that the
function might throw.
|
static java.lang.String |
getStacktraceCompact(java.lang.Throwable ex) |
static java.lang.String |
getStacktraceFull(java.lang.Throwable ex) |
public static java.lang.String formatByteSize(long numBytes)
public static java.lang.String formatDurationSince(long millisStart)
public static java.lang.String formatDurationSinceNano(long nanoStart)
public static java.lang.String formatDuration(long millis)
public static java.lang.String formatDuration(java.util.Locale locale, long millis)
public static java.lang.String formatDuration(java.util.Locale locale, long millis, FormatUtil.DurationFormatStyle style)
public static java.lang.String formatDuration(java.util.Locale locale, long millis, FormatUtil.DurationFormatStyle style, boolean alwaysShowMillis)
public static java.lang.String formatDurationSince(long millisStart, FormatUtil.DurationFormatStyle style)
public static java.lang.String formatDuration(long millis, FormatUtil.DurationFormatStyle style)
public static boolean customToString(java.lang.Throwable ex)
public static java.lang.String getStacktraceCompact(java.lang.Throwable ex)
public static java.lang.String getStacktraceFull(java.lang.Throwable ex)
public static java.lang.String formatDateFull(java.util.Date value)
public static java.lang.String formatSafe(java.lang.String value, java.lang.Object... formatArgs)
public static java.lang.String formatSafe(org.apache.log4j.Logger log, java.lang.String value, java.lang.Object... formatArgs)