Class FormattingUtils
java.lang.Object
org.torproject.metrics.descriptorparser.utils.FormattingUtils
Static helper methods for string processing etc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatBytes(long bytes) Formats the given number of bytes as B, KiB, MiB, GiB, etc.static StringformatDecimalNumber(long decimalNumber) Formats the given decimal number with a comma as thousands separator.static StringformatMillis(long millis) Formats the given number of milliseconds using the format"${minutes}:${seconds}.{milliseconds} minutes".static StringreplaceValidUtf(String text) De-escape only valid UTF and leave anything else escaped.
-
Method Details
-
formatMillis
Formats the given number of milliseconds using the format"${minutes}:${seconds}.{milliseconds} minutes". -
formatBytes
Formats the given number of bytes as B, KiB, MiB, GiB, etc. -
formatDecimalNumber
Formats the given decimal number with a comma as thousands separator. -
replaceValidUtf
De-escape only valid UTF and leave anything else escaped.
-