Consistently format byte sizes.

This commit is contained in:
Greyson Parrelli
2025-03-12 15:24:15 -04:00
parent d2006853c7
commit 22d908385b
16 changed files with 31 additions and 124 deletions

View File

@@ -76,7 +76,8 @@ class ByteSize(val bytes: Long) {
}
}
fun toUnitString(maxPlaces: Int = 1, spaced: Boolean = true): String {
@JvmOverloads
fun toUnitString(maxPlaces: Int = 2, spaced: Boolean = true): String {
val (size, unit) = getLargestNonZeroValue()
val formatter = NumberFormat.getInstance().apply {