Accept only official units.
This commit is contained in:
parent
715f97c971
commit
1a454e990a
1 changed files with 1 additions and 1 deletions
|
|
@ -52,10 +52,10 @@ class Configuration implements Dto {
|
||||||
static {
|
static {
|
||||||
// SI units and common abbreviations
|
// SI units and common abbreviations
|
||||||
BigInteger factor = BigInteger.ONE;
|
BigInteger factor = BigInteger.ONE;
|
||||||
|
unitMap.put("", factor);
|
||||||
BigInteger scale = BigInteger.valueOf(1000);
|
BigInteger scale = BigInteger.valueOf(1000);
|
||||||
for (var unit : List.of("B", "kB", "MB", "GB", "TB", "PB", "EB")) {
|
for (var unit : List.of("B", "kB", "MB", "GB", "TB", "PB", "EB")) {
|
||||||
unitMap.put(unit, factor);
|
unitMap.put(unit, factor);
|
||||||
unitMap.put(unit.substring(0, unit.length() - 1), factor);
|
|
||||||
factor = factor.multiply(scale);
|
factor = factor.multiply(scale);
|
||||||
}
|
}
|
||||||
// Binary units
|
// Binary units
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue