Package io.bdeploy.common.util
Class FormatHelper
java.lang.Object
io.bdeploy.common.util.FormatHelper
Contains static helpers to format various data types into a human readable format.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat(long timestamp) Formats the given date into a human readable stringstatic Stringformat(TemporalAccessor temporal) Formats the given date into a human readable stringstatic StringFormats the given date into a human readable stringstatic StringformatDuration(long timeInMillis) Formats the given duration into a human readable formatstatic StringformatFileSize(long size) Formats the given file size in bytes into a human readable format;static StringformatRemainingTime(long duration) Returns a human readable string of the given time.static StringformatTransferRate(long bytes, long timeInMs) Calculates and formats the transfer rate into a human readable string
-
Method Details
-
formatDuration
Formats the given duration into a human readable format -
formatRemainingTime
Returns a human readable string of the given time. Only the most relevant unit is displayed.Sample output: 4 seconds 15 minutes 1 hour- Parameters:
duration- The duration in milliseconds- Returns:
- The string representation.
-
formatTransferRate
Calculates and formats the transfer rate into a human readable string- Parameters:
bytes- the number of bytes that have been transferedtimeInMs- the time in milliseconds that the transfer took
-
format
Formats the given date into a human readable string -
format
Formats the given date into a human readable string -
format
Formats the given date into a human readable string -
formatFileSize
Formats the given file size in bytes into a human readable format;
-