Package org.infinispan.commons.util
Class ByteQuantity
java.lang.Object
org.infinispan.commons.util.ByteQuantity
Parser human-readable quantity of bytes.
- Since:
- 11.0
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ByteQuantity
public ByteQuantity()
-
-
Method Details
-
parse
Parses the byte quantity representation composed of a number plus a unit. When the unit is omitted, it is assumed as bytes (B). The supported units are:- kilobyte (KB): 1000 bytes
- megabyte (MB): 10002 bytes
- gigabyte (GB): 10003 bytes
- terabyte (TB): 10004 bytes
- kibibyte (KiB): 1024 bytes
- mebibyte (MiB): 10242 bytes
- gibibyte (GiB): 10243 bytes
- tebibyte (TiB): 10244 bytes
Examples:
1000
,10 GB
,1.5TB
,100 GiB
- Parameters:
str
- The String representing a quantity (can have decimals) plus the optional unit.- Returns:
- long number of bytes
- Throws:
IllegalArgumentException
- if the string cannot be parsed.
-