Class ByteQuantity


  • public final class ByteQuantity
    extends Object
    Parser human-readable quantity of bytes.
    Since:
    11.0
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteQuantity()  
    • Constructor Detail

      • ByteQuantity

        public ByteQuantity()
    • Method Detail

      • parse

        public static long parse​(String str)
                          throws IllegalArgumentException
        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.