Package org.frankframework.util
Class Misc
java.lang.Object
org.frankframework.util.Misc
Miscellaneous conversion functions.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetAge(long value) static StringgetDurationInMs(long value) static Stringstatic longstatic longstatic StringtoFileSize(long bytes) static StringtoFileSize(long bytes, boolean format) static StringtoFileSize(long bytes, boolean format, boolean useSiUnits) Format bytes as human-readable text.static longtoFileSize(String value, long defaultValue) Converts the file size to bytes.
-
Field Details
-
MESSAGE_SIZE_WARN_BY_DEFAULT_KEY
- See Also:
-
LINE_SEPARATOR
-
-
Method Details
-
getHostname
-
toFileSize
Converts the file size to bytes.Misc.toFileSize("14GB", 20); // gives out 15032385536 -
toFileSize
- See Also:
-
toFileSize
- See Also:
-
toFileSize
Format bytes as human-readable text.String kbIecUnits = Misc.toFileSize(150000, false, false); // gives out "146KiB" String mbIecUnits = Misc.toFileSize(15000000, true); // gives out "14 MiB" String gbIecUnits = Misc.toFileSize(Long.parseLong("3221225472")); // gives out "3GiB" String kbSiUnits = Misc.toFileSize(150000, true, false); // gives out "150kB" String mbSiUnits = Misc.toFileSize(15000000, true, true); // gives out "15 MB" String gbSiUnits = Misc.toFileSize(Long.parseLong("3221225472"), true, false); // gives out "3GB"- Parameters:
bytes- Number of bytes. Should be positive, value is returned as string if negative.format- True to insert space between value and unit.useSiUnits- True to use metric (SI) units, aka powers of 1000. False to use binary (IEC), aka powers of 1024.- Returns:
- Formatted string.
-
getMessageSizeWarnByDefault
public static long getMessageSizeWarnByDefault() -
getAge
-
getDurationInMs
-
parseAge
- Returns:
- 'age' in milliseconds.
-