• Jochen Schalanda's avatar
    Add data size class adhering to the correct SI and IEC prefixes (#2686) · 184dadf8
    Jochen Schalanda authored
    The `Size` and `SizeUnit` classes in Dropwizard are using a common but incorrect definition of data size units, in which 1 kilobyte equals 1024 bytes.
    The `DataSize` and `DataSizeUnit` classes are using the correct definitions according to SI and IEC, in which 1 kilobyte equals 1000 bytes and 1 kibibytes equals 1024 bytes.
    Instead of modifying the existing `Size` and `SizeUnit` classes, this change set introduces a new set of classes, `DataSize` and `DataSizeUnit`, with the possibility to convert the old units into the new, correct units.
    assertEquals(Size.parse("128 kb").toDataSize(), DataSize.kibibytes(128L));
    This is a breaking change and has to be properly documented in the release notes and upgrade notes of Dropwizard.
    Closes #2152
    Closes #2154
Last commit
Last update
main/java/io/dropwizard/validation Loading commit data...
test Loading commit data...