public static BytesQuantity fromString(String value) {
        var matcher = PATTERN.matcher(value);
        if (!matcher.matches())
            throw new IllegalArgumentException(
                    "Bytes quantity '%s' does not match pattern '%s'".formatted(value, PATTERN.pattern()));
        var digits = Long.parseLong(matcher.group("digits"));
        var unit = Unit.fromString(matcher.group("unit"));
        return BytesQuantity.of(digits, unit);
    }
Reprents a quantity of bytes with a human-readable string representation.
Currently only supports binary units (e.g. 1 kB = 1024 bytes).

@author bjorncs
vespajlib/src/main/java/ai/vespa/utils/BytesQuantity.java